From c4065c976c4e20b5b4b9c38778adf5a55d94f0b9 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 2 Mar 2020 19:49:34 -0800 Subject: [PATCH] pm/fusee: add support for 9.2.0 --- fusee/fusee-secondary/src/kernel_patches.c | 10 ++++++++++ .../libmesosphere/source/init/kern_init_slab_setup.cpp | 2 +- .../libvapours/include/vapours/ams/ams_api_version.h | 2 +- stratosphere/pm/source/impl/pm_resource_manager.cpp | 7 +++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/fusee/fusee-secondary/src/kernel_patches.c b/fusee/fusee-secondary/src/kernel_patches.c index 659ce8e08..0a6c4c079 100644 --- a/fusee/fusee-secondary/src/kernel_patches.c +++ b/fusee/fusee-secondary/src/kernel_patches.c @@ -801,6 +801,16 @@ static const kernel_info_t g_kernel_infos[] = { .embedded_ini_ptr = 0x180, .free_code_space_offset = 0x65780, KERNEL_PATCHES(900) + }, + { /* 9.2.0. */ + /* NOTE: 9.2.0 has identical kernel layout to 9.0.0, so patches may be reused. */ + .hash = {0x66, 0xE7, 0x73, 0xE7, 0xF5, 0xCB, 0x9B, 0xB8, 0x66, 0xB7, 0xB1, 0x26, 0x23, 0x02, 0x76, 0xF2, 0xD1, 0x60, 0x3E, 0x09, 0x14, 0x19, 0xC2, 0x84, 0xFA, 0x5D, 0x0F, 0x16, 0xA3, 0x65, 0xFA, 0x17}, + .hash_offset = 0x1C0, + .hash_size = 0x90000 - 0x1C0, + .embedded_ini_offset = 0x90000, + .embedded_ini_ptr = 0x180, + .free_code_space_offset = 0x65780, + KERNEL_PATCHES(900) } }; diff --git a/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp b/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp index db644ec1a..65451a9b6 100644 --- a/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp +++ b/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp @@ -63,7 +63,7 @@ namespace ams::kern::init { constexpr size_t SlabCountKTransferMemory = 200; constexpr size_t SlabCountKCodeMemory = 10; constexpr size_t SlabCountKDeviceAddressSpace = 300; - constexpr size_t SlabCountKSession = 900; + constexpr size_t SlabCountKSession = 933; constexpr size_t SlabCountKLightSession = 100; constexpr size_t SlabCountKObjectName = 7; constexpr size_t SlabCountKResourceLimit = 5; diff --git a/libraries/libvapours/include/vapours/ams/ams_api_version.h b/libraries/libvapours/include/vapours/ams/ams_api_version.h index db082832e..652478ffb 100644 --- a/libraries/libvapours/include/vapours/ams/ams_api_version.h +++ b/libraries/libvapours/include/vapours/ams/ams_api_version.h @@ -22,5 +22,5 @@ #define ATMOSPHERE_RELEASE_VERSION ATMOSPHERE_RELEASE_VERSION_MAJOR, ATMOSPHERE_RELEASE_VERSION_MINOR, ATMOSPHERE_RELEASE_VERSION_MICRO #define ATMOSPHERE_SUPPORTED_HOS_VERSION_MAJOR 9 -#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 1 +#define ATMOSPHERE_SUPPORTED_HOS_VERSION_MINOR 2 #define ATMOSPHERE_SUPPORTED_HOS_VERSION_MICRO 0 diff --git a/stratosphere/pm/source/impl/pm_resource_manager.cpp b/stratosphere/pm/source/impl/pm_resource_manager.cpp index 48132b641..cfff9bbc9 100644 --- a/stratosphere/pm/source/impl/pm_resource_manager.cpp +++ b/stratosphere/pm/source/impl/pm_resource_manager.cpp @@ -35,6 +35,7 @@ namespace ams::pm::resource { constexpr size_t ExtraSystemEventCount600 = 100; constexpr size_t ExtraSystemSessionCount600 = 100; constexpr size_t ReservedMemorySize600 = 5_MB; + constexpr size_t ExtraSystemSessionCount920 = 33; /* Atmosphere always allocates extra memory for system usage. */ constexpr size_t ExtraSystemMemorySizeAtmosphere = 24_MB; @@ -205,6 +206,12 @@ namespace ams::pm::resource { g_resource_limits[ResourceLimitGroup_System][LimitableResource_Events] += ExtraSystemEventCount600; g_resource_limits[ResourceLimitGroup_System][LimitableResource_Sessions] += ExtraSystemSessionCount600; } + if (hos_version >= hos::Version_900) { + /* 9.2.0 increased the system session limit. */ + /* NOTE: We don't currently support detection of minor version, so we will provide this increase on 9.0.0+. */ + /* This shouldn't impact any existing behavior in undesirable ways. */ + g_resource_limits[ResourceLimitGroup_System][LimitableResource_Sessions] += ExtraSystemSessionCount920; + } /* 7.0.0+: Calculate the number of extra application threads available. */ if (hos::GetVersion() >= hos::Version_700) {