From 3e88d83896c2b00a10c599f35fe8044f108569c8 Mon Sep 17 00:00:00 2001 From: JPikachu Date: Thu, 30 Oct 2025 23:09:00 +0000 Subject: [PATCH] add the 0x500000 offset that Ryu uses --- src/core/hle/kernel/k_process.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 51f86b2afd..59c5fdc174 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -28,6 +28,9 @@ namespace Kernel { namespace { +// TODO: Remove this workaround when proper ASLR is implemented for all address spaces. +constexpr u64 CodeStartOffset = 0x500000UL; + Result TerminateChildren(KernelCore& kernel, KProcess* process, const KThread* thread_to_not_terminate) { // Request that all children threads terminate. @@ -1190,19 +1193,19 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std: // However, some (buggy) programs/libraries like skyline incorrectly depend on the // existence of ASLR pages before the entry point, so we will adjust the load address // to point to about 2GiB into the ASLR region. - code_address = 0x8000'0000; + code_address = 0x8000'0000 + CodeStartOffset; break; case FileSys::ProgramAddressSpaceType::Is36Bit: flag |= Svc::CreateProcessFlag::AddressSpace64BitDeprecated; - code_address = 0x800'0000; + code_address = 0x800'0000 + CodeStartOffset; break; case FileSys::ProgramAddressSpaceType::Is32Bit: flag |= Svc::CreateProcessFlag::AddressSpace32Bit; - code_address = 0x20'0000; + code_address = 0x20'0000 + CodeStartOffset; break; case FileSys::ProgramAddressSpaceType::Is32BitNoMap: flag |= Svc::CreateProcessFlag::AddressSpace32BitWithoutAlias; - code_address = 0x20'0000; + code_address = 0x20'0000 + CodeStartOffset; break; }