diff --git a/stratosphere/loader/source/ldr_main.cpp b/stratosphere/loader/source/ldr_main.cpp index 5d6f5a01c..94a52fcbf 100644 --- a/stratosphere/loader/source/ldr_main.cpp +++ b/stratosphere/loader/source/ldr_main.cpp @@ -16,7 +16,7 @@ extern "C" { u32 __nx_applet_type = AppletType_None; - #define INNER_HEAP_SIZE 0x200000 + #define INNER_HEAP_SIZE 0x20000 size_t nx_inner_heap_size = INNER_HEAP_SIZE; char nx_inner_heap[INNER_HEAP_SIZE]; diff --git a/stratosphere/pm/source/pm_main.cpp b/stratosphere/pm/source/pm_main.cpp index 5a65793fd..4ce175465 100644 --- a/stratosphere/pm/source/pm_main.cpp +++ b/stratosphere/pm/source/pm_main.cpp @@ -18,7 +18,7 @@ extern "C" { u32 __nx_applet_type = AppletType_None; - #define INNER_HEAP_SIZE 0x200000 + #define INNER_HEAP_SIZE 0x20000 size_t nx_inner_heap_size = INNER_HEAP_SIZE; char nx_inner_heap[INNER_HEAP_SIZE]; diff --git a/stratosphere/pm/source/pm_resource_limits.cpp b/stratosphere/pm/source/pm_resource_limits.cpp index f45f135e9..4149ccfac 100644 --- a/stratosphere/pm/source/pm_resource_limits.cpp +++ b/stratosphere/pm/source/pm_resource_limits.cpp @@ -3,6 +3,9 @@ #include "pm_resource_limits.hpp" +/* Give 24 MiB to SYSTEM from Applet. This allows for more custom sysmodules. */ +#define ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES 0x1800000ULL + /* Memory that system, application, applet are allowed to allocate. */ static const u64 g_memory_resource_limits_deprecated[5][3] = { {0x010D00000ULL, 0x0CD500000ULL, 0x021700000ULL}, @@ -78,6 +81,11 @@ void ResourceLimitUtils::InitializeLimits() { memcpy(&g_memory_resource_limits, &g_memory_resource_limits_deprecated, sizeof(g_memory_resource_limits)); memcpy(&g_resource_limits, &g_resource_limits_deprecated, sizeof(g_resource_limits)); } + /* Atmosphere: Allocate extra memory (24 MiB) to SYSTEM away from Applet. */ + for (unsigned int i = 0; i < 5; i++) { + g_memory_resource_limits[i][0] += ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES; + g_memory_resource_limits[i][2] -= ATMOSPHERE_EXTRA_SYSTEM_MEMORY_FOR_SYSMODULES; + } /* Get memory limits. */ u64 memory_arrangement; if (R_FAILED(splGetConfig(SplConfigItem_MemoryArrange, &memory_arrangement))) { diff --git a/stratosphere/sm/source/sm_main.cpp b/stratosphere/sm/source/sm_main.cpp index e68b6674d..410058383 100644 --- a/stratosphere/sm/source/sm_main.cpp +++ b/stratosphere/sm/source/sm_main.cpp @@ -15,7 +15,7 @@ extern "C" { u32 __nx_applet_type = AppletType_None; - #define INNER_HEAP_SIZE 0x200000 + #define INNER_HEAP_SIZE 0x20000 size_t nx_inner_heap_size = INNER_HEAP_SIZE; char nx_inner_heap[INNER_HEAP_SIZE];