mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-02 06:06:24 +00:00
Merge pull request #325 from artart78/master
Load ELFs at the correct place
This commit is contained in:
commit
796f1111d3
@ -201,10 +201,21 @@ bool ElfReader::LoadInto(u32 loadAddress)
|
||||
}
|
||||
}
|
||||
u32 totalSize = totalEnd - totalStart;
|
||||
if (loadAddress)
|
||||
vaddr = userMemory.AllocAt(loadAddress, totalSize, "ELF");
|
||||
if (!bRelocate)
|
||||
{
|
||||
// Binary is prerelocated, load it where the first segment starts
|
||||
vaddr = userMemory.AllocAt(totalStart, totalSize, "ELF");
|
||||
}
|
||||
else if (loadAddress)
|
||||
{
|
||||
// Binary needs to be relocated: add loadAddress to the binary start address
|
||||
vaddr = userMemory.AllocAt(loadAddress + totalStart, totalSize, "ELF");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just put it where there is room
|
||||
vaddr = userMemory.Alloc(totalSize, false, "ELF");
|
||||
}
|
||||
|
||||
if (vaddr == -1) {
|
||||
ERROR_LOG(LOADER, "Failed to allocate memory for ELF!");
|
||||
|
Loading…
Reference in New Issue
Block a user