From 683a0d55bfbb1d0ff14698c1d43e11a36af6fca2 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 26 Mar 2024 18:29:37 +0200 Subject: [PATCH] we can now load libc.prx --- src/core/linker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/linker.cpp b/src/core/linker.cpp index 23c600548..712b4fb17 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -16,7 +16,8 @@ namespace Core { -static constexpr u64 LoadAddress = SYSTEM_RESERVED + CODE_BASE_OFFSET; +static u64 LoadAddress = SYSTEM_RESERVED + CODE_BASE_OFFSET; +static constexpr u64 CODE_BASE_INCR = 0x010000000u; static u64 GetAlignedSize(const elf_program_header& phdr) { return (phdr.p_align != 0 ? (phdr.p_memsz + (phdr.p_align - 1)) & ~(phdr.p_align - 1) @@ -104,6 +105,8 @@ void Linker::LoadModuleToMemory(Module* m) { m->base_virtual_addr = VirtualMemory::memory_alloc(LoadAddress, m->aligned_base_size, VirtualMemory::MemoryMode::ExecuteReadWrite); + LoadAddress += CODE_BASE_INCR * (1 + m->aligned_base_size / CODE_BASE_INCR); + LOG_INFO(Core_Linker, "====Load Module to Memory ========"); LOG_INFO(Core_Linker, "base_virtual_addr ......: {:#018x}", m->base_virtual_addr); LOG_INFO(Core_Linker, "base_size ..............: {:#018x}", base_size);