From f57583168d8e291e50869eb5a2d6efe11df1114a Mon Sep 17 00:00:00 2001 From: Stephen Miller Date: Sat, 3 May 2025 20:14:09 -0500 Subject: [PATCH] Hardcode hardware accurate base address Looking at our address space, all platforms will have this base address mapped, so there shouldn't be any problem in using it. --- src/core/module.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/module.cpp b/src/core/module.cpp index 3f1fb5258..eb74e653b 100644 --- a/src/core/module.cpp +++ b/src/core/module.cpp @@ -19,6 +19,7 @@ namespace Core { using EntryFunc = PS4_SYSV_ABI int (*)(size_t args, const void* argp, void* param); +static constexpr u64 ModuleLoadBase = 0x800000000; static u64 LoadOffset = 0; static u64 GetAlignedSize(const elf_program_header& phdr) { @@ -112,7 +113,7 @@ void Module::LoadModuleToMemory(u32& max_tls_index) { // Map module segments (and possible TLS trampolines) void** out_addr = reinterpret_cast(&base_virtual_addr); - memory->MapMemory(out_addr, memory->SystemReservedVirtualBase() + LoadOffset, + memory->MapMemory(out_addr, ModuleLoadBase + LoadOffset, aligned_base_size + TrampolineSize, MemoryProt::CpuReadWrite, MemoryMapFlags::Fixed, VMAType::Code, name, true); LoadOffset += aligned_base_size + TrampolineSize;