diff --git a/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp b/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp index 22e99faf..58e86f15 100644 --- a/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp +++ b/libmesosphere/source/board/nintendo/nx/kern_k_system_control.cpp @@ -361,7 +361,9 @@ namespace ams::kern::board::nintendo::nx { }(); /* Return (possibly) adjusted size. */ - constexpr size_t ExtraSystemMemoryForAtmosphere = 40_MB; + /* NOTE: On 20.0.0+ the browser requires much more memory in the applet pool in order to function. */ + /* Thus, we have to reduce our extra system memory size by 26 MB to compensate. */ + const size_t ExtraSystemMemoryForAtmosphere = kern::GetTargetFirmware() >= ams::TargetFirmware_20_0_0 ? 14_MB : 40_MB; return base_pool_size - ExtraSystemMemoryForAtmosphere - KTraceBufferSize; } diff --git a/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp b/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp index d51eb90e..ca1c5cb5 100644 --- a/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp +++ b/libstratosphere/include/stratosphere/ams/impl/ams_system_thread_definitions.hpp @@ -171,6 +171,8 @@ namespace ams::impl { AMS_DEFINE_SYSTEM_THREAD(21, TioServer, FileServerHtcsServer); AMS_DEFINE_SYSTEM_THREAD(21, TioServer, SdCardObserver); + AMS_DEFINE_SYSTEM_THREAD(16, memlet, Main); + /* ServiceProfile */ AMS_DEFINE_SYSTEM_THREAD(-1, sprofile, IpcServer); diff --git a/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp b/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp index b02c38fc..b8e7bcd4 100644 --- a/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp +++ b/libstratosphere/include/stratosphere/ncm/ncm_system_content_meta_id.hpp @@ -121,13 +121,15 @@ namespace ams::ncm { static const AtmosphereProgramId Mitm; static const AtmosphereProgramId AtmosphereLogManager; + static const AtmosphereProgramId AtmosphereMemlet; }; inline constexpr const AtmosphereProgramId AtmosphereProgramId::Mitm = { 0x010041544D530000ul }; inline constexpr const AtmosphereProgramId AtmosphereProgramId::AtmosphereLogManager = { 0x0100000000000420ul }; + inline constexpr const AtmosphereProgramId AtmosphereProgramId::AtmosphereMemlet = { 0x0100000000000421ul }; inline constexpr bool IsAtmosphereProgramId(const ProgramId &program_id) { - return program_id == AtmosphereProgramId::Mitm || program_id == AtmosphereProgramId::AtmosphereLogManager; + return program_id == AtmosphereProgramId::Mitm || program_id == AtmosphereProgramId::AtmosphereLogManager || program_id == AtmosphereProgramId::AtmosphereMemlet; } inline constexpr bool IsSystemProgramId(const AtmosphereProgramId &) { diff --git a/libstratosphere/source/boot2/boot2_api.board.nintendo_nx.cpp b/libstratosphere/source/boot2/boot2_api.board.nintendo_nx.cpp index e5f27fce..5f7f296a 100644 --- a/libstratosphere/source/boot2/boot2_api.board.nintendo_nx.cpp +++ b/libstratosphere/source/boot2/boot2_api.board.nintendo_nx.cpp @@ -450,6 +450,9 @@ namespace ams::boot2 { LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::SystemProgramId::Migration, ncm::StorageId::BuiltInSystem), 0); } + /* Launch atmosphere's applet memory service program. */ + LaunchProgram(nullptr, ncm::ProgramLocation::Make(ncm::AtmosphereProgramId::AtmosphereMemlet, ncm::StorageId::None), 0); + /* Launch user programs off of the SD. */ LaunchFlaggedProgramsOnSdCard(); } diff --git a/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp b/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp index b336576f..94450ef2 100644 --- a/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp +++ b/libstratosphere/source/os/impl/os_shared_memory_impl.os.horizon.cpp @@ -43,6 +43,7 @@ namespace ams::os::impl { R_TRY_CATCH(svc::CreateSharedMemory(std::addressof(handle), size, svc_my_perm, svc_other_perm)) { R_CONVERT(svc::ResultOutOfHandles, os::ResultOutOfHandles()) R_CONVERT(svc::ResultOutOfResource, os::ResultOutOfResource()) + R_CONVERT(svc::ResultLimitReached, os::ResultOutOfMemory()) } R_END_TRY_CATCH_WITH_ABORT_UNLESS; *out = handle;