More memory fixes

This commit is contained in:
wheremyfoodat 2025-08-06 00:05:05 +03:00
commit d26235cf8b
2 changed files with 3 additions and 1 deletions

View file

@ -186,6 +186,8 @@ class Memory {
// perms |= Common::MemoryPermission::Execute;
}
// If anything is mapped at the place we're trying to map, unmap it. Then, create our mapping.
arena->Unmap(guestVaddr, size, false);
arena->Map(guestVaddr, arenaOffset, size, perms, false);
}
}

View file

@ -40,7 +40,7 @@ bool Memory::mapCXI(NCSD& ncsd, NCCH& cxi) {
// Total memory to allocate for loading
u32 totalSize = (cxi.text.pageCount + cxi.rodata.pageCount + cxi.data.pageCount) * pageSize + bssSize;
if (code.size() < totalSize) {
if (code.size() + bssSize < totalSize) {
Helpers::panic("Total code size as reported by the exheader is larger than the .code file");
return false;
}