mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-08 03:51:39 +12:00
RO: Unmap CROs when unloaded
Thanks @noumidev
This commit is contained in:
parent
6c4c20fe3e
commit
546be9b6f9
1 changed files with 11 additions and 1 deletions
|
@ -22,6 +22,7 @@ namespace CROHeader {
|
|||
NameOffset = 0x084,
|
||||
NextCRO = 0x088,
|
||||
PrevCRO = 0x08C,
|
||||
FileSize = 0x090,
|
||||
OnUnresolved = 0x0AC,
|
||||
CodeOffset = 0x0B0,
|
||||
DataOffset = 0x0B8,
|
||||
|
@ -177,6 +178,10 @@ public:
|
|||
mem.write32(croPointer + CROHeader::PrevCRO, prevCRO);
|
||||
}
|
||||
|
||||
u32 getSize() {
|
||||
return mem.read32(croPointer + CROHeader::FileSize);
|
||||
}
|
||||
|
||||
void write32(u32 addr, u32 value) {
|
||||
// Note: some games export symbols to the static module, which doesn't contain any segments.
|
||||
// Instead, its segments point to ROM segments. We need this special write handler for writes to .text, which
|
||||
|
@ -1400,7 +1405,12 @@ void LDRService::unloadCRO(u32 messagePointer) {
|
|||
Helpers::panic("Failed to unrebase CRO");
|
||||
}
|
||||
|
||||
// TODO: unmap the CRO from the pagetable
|
||||
u32 size = cro.getSize();
|
||||
bool succeeded = mem.mapVirtualMemory(mapVaddr, croPointer, size >> 12, false, false, false,
|
||||
MemoryState::Locked, MemoryState::AliasCode, MemoryState::Free, MemoryState::Private);
|
||||
if (!succeeded) {
|
||||
Helpers::panic("Failed to unmap CRO");
|
||||
}
|
||||
|
||||
kernel.clearInstructionCache();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue