we can now load libc.prx

This commit is contained in:
georgemoralis 2024-03-26 18:29:37 +02:00
parent 1a7f5f7b31
commit 683a0d55bf
1 changed files with 4 additions and 1 deletions

View File

@ -16,7 +16,8 @@
namespace Core { 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) { static u64 GetAlignedSize(const elf_program_header& phdr) {
return (phdr.p_align != 0 ? (phdr.p_memsz + (phdr.p_align - 1)) & ~(phdr.p_align - 1) 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, m->base_virtual_addr = VirtualMemory::memory_alloc(LoadAddress, m->aligned_base_size,
VirtualMemory::MemoryMode::ExecuteReadWrite); 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, "====Load Module to Memory ========");
LOG_INFO(Core_Linker, "base_virtual_addr ......: {:#018x}", m->base_virtual_addr); LOG_INFO(Core_Linker, "base_virtual_addr ......: {:#018x}", m->base_virtual_addr);
LOG_INFO(Core_Linker, "base_size ..............: {:#018x}", base_size); LOG_INFO(Core_Linker, "base_size ..............: {:#018x}", base_size);