mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-13 14:30:27 +02:00
Merge pull request #325 from artart78/master
Load ELFs at the correct place
This commit is contained in:
commit
796f1111d3
1 file changed
+13
-2
+13
-2
@@ -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!");
|
||||
|
||||
Reference in new issue
Block a user