mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Workaround issue where some homebrew (like moppi-flower) would erroneously load into kernel ram where it won't fit
This commit is contained in:
parent
58b223e974
commit
04ce8a63e5
@ -393,7 +393,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
|
||||
}
|
||||
|
||||
bool kernelModule = modInfo ? (modInfo->moduleAttrs & 0x1000) != 0 : false;
|
||||
BlockAllocator &memblock = kernelModule ? kernelMemory : userMemory;
|
||||
|
||||
std::string modName = "ELF";
|
||||
if (modInfo) {
|
||||
size_t n = strnlen(modInfo->name, 28);
|
||||
@ -413,6 +413,11 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
|
||||
}
|
||||
}
|
||||
totalSize = totalEnd - totalStart;
|
||||
|
||||
// If a load address is specified that's in regular RAM, override kernel module status
|
||||
bool inUser = totalStart > 0x08900000;
|
||||
BlockAllocator &memblock = (kernelModule && !inUser) ? kernelMemory : userMemory;
|
||||
|
||||
if (!bRelocate)
|
||||
{
|
||||
// Binary is prerelocated, load it where the first segment starts
|
||||
@ -433,7 +438,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop)
|
||||
ERROR_LOG_REPORT(LOADER, "Failed to allocate memory for ELF!");
|
||||
return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED;
|
||||
}
|
||||
|
||||
|
||||
if (bRelocate) {
|
||||
DEBUG_LOG(LOADER,"Relocatable module");
|
||||
entryPoint += vaddr;
|
||||
|
@ -131,7 +131,7 @@ u32 BlockAllocator::AllocAligned(u32 &size, u32 sizeGrain, u32 grain, bool fromT
|
||||
|
||||
//Out of memory :(
|
||||
ListBlocks();
|
||||
ERROR_LOG(HLE, "Block Allocator failed to allocate %i (%08x) bytes of contiguous memory", size, size);
|
||||
ERROR_LOG(HLE, "Block Allocator (%08x-%08x) failed to allocate %i (%08x) bytes of contiguous memory", rangeStart_, rangeStart_ + rangeSize_, size, size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag)
|
||||
ERROR_LOG(HLE, "Clearly bogus size: %08x - failing allocation", size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// Downalign the position so we're allocating full blocks.
|
||||
u32 alignedPosition = position;
|
||||
u32 alignedSize = size;
|
||||
@ -212,10 +212,10 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag)
|
||||
ERROR_LOG(HLE, "Block allocator AllocAt failed :( %08x, %i", position, size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Out of memory :(
|
||||
ListBlocks();
|
||||
ERROR_LOG(HLE, "Block Allocator failed to allocate %i bytes of contiguous memory", alignedSize);
|
||||
ERROR_LOG(HLE, "Block Allocator (%08x-%08x) failed to allocate %i (%08x) bytes of contiguous memory", rangeStart_, rangeStart_ + rangeSize_, alignedSize, alignedSize);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user