diff --git a/libmesosphere/include/mesosphere/kern_initial_process.hpp b/libmesosphere/include/mesosphere/kern_initial_process.hpp index 91129819..a7dfeab7 100644 --- a/libmesosphere/include/mesosphere/kern_initial_process.hpp +++ b/libmesosphere/include/mesosphere/kern_initial_process.hpp @@ -32,6 +32,7 @@ namespace ams::kern { struct InitialProcessBinaryLayout { uintptr_t address; uintptr_t _08; + uintptr_t kern_address; }; struct InitialProcessBinaryLayoutWithSize { diff --git a/libmesosphere/include/mesosphere/kern_k_system_control_base.hpp b/libmesosphere/include/mesosphere/kern_k_system_control_base.hpp index 095bff49..bb1c1ff0 100644 --- a/libmesosphere/include/mesosphere/kern_k_system_control_base.hpp +++ b/libmesosphere/include/mesosphere/kern_k_system_control_base.hpp @@ -53,7 +53,7 @@ namespace ams::kern { static size_t GetRealMemorySize(); static size_t GetIntendedMemorySize(); static KPhysicalAddress GetKernelPhysicalBaseAddress(KPhysicalAddress base_address); - static void GetInitialProcessBinaryLayout(InitialProcessBinaryLayout *out); + static void GetInitialProcessBinaryLayout(InitialProcessBinaryLayout *out, KPhysicalAddress kern_base_address); static bool ShouldIncreaseThreadResourceLimit(); static void TurnOnCpu(u64 core_id, const ams::kern::init::KInitArguments *args); static size_t GetApplicationPoolSize(); diff --git a/libmesosphere/source/kern_k_system_control_base.cpp b/libmesosphere/source/kern_k_system_control_base.cpp index 77582203..6764662d 100644 --- a/libmesosphere/source/kern_k_system_control_base.cpp +++ b/libmesosphere/source/kern_k_system_control_base.cpp @@ -46,10 +46,11 @@ namespace ams::kern { } } - void KSystemControlBase::Init::GetInitialProcessBinaryLayout(InitialProcessBinaryLayout *out) { + void KSystemControlBase::Init::GetInitialProcessBinaryLayout(InitialProcessBinaryLayout *out, KPhysicalAddress kern_base_address) { *out = { - .address = GetInteger(KSystemControl::Init::GetKernelPhysicalBaseAddress(ams::kern::MainMemoryAddress)) + KSystemControl::Init::GetIntendedMemorySize() - InitialProcessBinarySizeMax, - ._08 = 0, + .address = GetInteger(KSystemControl::Init::GetKernelPhysicalBaseAddress(ams::kern::MainMemoryAddress)) + KSystemControl::Init::GetIntendedMemorySize() - InitialProcessBinarySizeMax, + ._08 = 0, + .kern_address = GetInteger(kern_base_address), }; }