diff options
| author | JPikachu <jpikachu@eden-emu.dev> | 2025-10-31 19:49:37 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-10-31 19:49:37 +0100 |
| commit | ead5978b34561eb3a709dfd0c61169e9c2c036a2 (patch) | |
| tree | c3702813e50aa4f83c06047a56bbf52080ecdb03 /src/core/hle/kernel/k_process.cpp | |
| parent | bfb112dad16dd4ef460aaf97f459c2bbde3fabe6 (diff) | |
[kernel] Implement code address offset for Skyline compatibility (#2858)
- Add debug logging for 32-bit syscall argument tracking.
- Add CodeStartOffset constant (0x500000) applied to only 32-bit code address space
types in KProcess::LoadFromMetadata.
- Replace CheckMemoryStateContiguous with two-stage CheckMemoryState
in KPageTableBase::UnmapCodeMemory to discover and verify memory
state more accurately.
Based on similar fixes in Ryujinx (commit 5e9678c8fe)
Fixes compatibility with:
- Skyline 32-bit modding framework
- CTGP-DX (Mario Kart 8 Deluxe mod)
- Other homebrew using 32bit Skyline
Co-authored-by: JPikachu <jpikachu.eden@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2858
Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Co-authored-by: JPikachu <jpikachu@eden-emu.dev>
Co-committed-by: JPikachu <jpikachu@eden-emu.dev>
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 51f86b2afd..355a2a5f3b 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. @@ -1198,11 +1201,11 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std: 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; } |
