summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZephyron <zephyron@citron-emu.org>2025-01-07 18:50:11 +1000
committerMike Lothian <mike@fireburn.co.uk>2025-05-11 12:17:03 +0100
commit455992c2a7debc9c7aee390aa164f6a619d3943f (patch)
tree842471f525c182f5ee602c7319ac017d0958780d
parent4f61ee284f4b0af64f38433f5bacaa5bb72e39a6 (diff)
kernel: Implement SystemResourceSize info type for VAMM initialization
Adds support for InfoType::SystemResourceSize (0x1C) which is required for proper initialization of the Virtual Address Memory Manager (VAMM). This implementation: 1. Adds SystemResourceSize to the InfoType enum in svc_types.h 2. Implements the GetInfo handler for SystemResourceSize in svc_info.cpp 3. Returns 512MB (0x20000000 bytes) as the system resource size 4. Adds debug logging for the SVC call The 512MB value is chosen based on typical system resource allocations needed for VAMM initialization on the Nintendo Switch. This fixes crashes in games that rely on VAMM functionality, particularly during nn::os::detail::VammManager::InitializeIfEnabled().
-rw-r--r--src/core/hle/kernel/svc/svc_info.cpp10
-rw-r--r--src/core/hle/kernel/svc_types.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp
index 007bb9f70..64abc719c 100644
--- a/src/core/hle/kernel/svc/svc_info.cpp
+++ b/src/core/hle/kernel/svc/svc_info.cpp
@@ -233,6 +233,16 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
*result = system.Kernel().CurrentScheduler()->GetIdleThread()->GetCpuTime();
R_SUCCEED();
}
+ case InfoType::SystemResourceSize: {
+ LOG_DEBUG(Kernel_SVC, "called info_type={:#x}, info_subtype={:#x}, handle={:#x}", info_id,
+ info_sub_id, handle);
+
+ // VAMM (Virtual Address Memory Manager) typically expects a larger memory size
+ // The value below (512MB) is based on typical system resource allocations
+ *result = 0x20000000; // 512MB in bytes
+
+ R_SUCCEED();
+ }
case InfoType::MesosphereCurrentProcess: {
// Verify the input handle is invalid.
R_UNLESS(handle == InvalidHandle, ResultInvalidHandle);
diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h
index df92fa008..58d7ca9b9 100644
--- a/src/core/hle/kernel/svc_types.h
+++ b/src/core/hle/kernel/svc_types.h
@@ -157,6 +157,7 @@ enum class InfoType : u32 {
MesosphereMeta = 65000,
MesosphereCurrentProcess = 65001,
+ SystemResourceSize = 0x1D,
};
enum class BreakReason : u32 {