mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
Merge pull request #3563 from bunnei/fix-ldr-memstate
services: ldr: Fix MemoryState for read/write regions of NROs.
This commit is contained in:
commit
9d8886b1a4
|
@ -342,17 +342,27 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(
|
// Mark text and read-only region as ModuleCode
|
||||||
vm_manager
|
ASSERT(vm_manager
|
||||||
.MirrorMemory(*map_address, nro_address, nro_size, Kernel::MemoryState::ModuleCode)
|
.MirrorMemory(*map_address, nro_address, header.text_size + header.ro_size,
|
||||||
.IsSuccess());
|
Kernel::MemoryState::ModuleCode)
|
||||||
|
.IsSuccess());
|
||||||
|
// Mark read/write region as ModuleCodeData, which is necessary if this region is used for
|
||||||
|
// TransferMemory (e.g. Final Fantasy VIII Remastered does this)
|
||||||
|
ASSERT(vm_manager
|
||||||
|
.MirrorMemory(*map_address + header.rw_offset, nro_address + header.rw_offset,
|
||||||
|
header.rw_size, Kernel::MemoryState::ModuleCodeData)
|
||||||
|
.IsSuccess());
|
||||||
|
// Revoke permissions from the old memory region
|
||||||
ASSERT(vm_manager.ReprotectRange(nro_address, nro_size, Kernel::VMAPermission::None)
|
ASSERT(vm_manager.ReprotectRange(nro_address, nro_size, Kernel::VMAPermission::None)
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
|
|
||||||
if (bss_size > 0) {
|
if (bss_size > 0) {
|
||||||
|
// Mark BSS region as ModuleCodeData, which is necessary if this region is used for
|
||||||
|
// TransferMemory (e.g. Final Fantasy VIII Remastered does this)
|
||||||
ASSERT(vm_manager
|
ASSERT(vm_manager
|
||||||
.MirrorMemory(*map_address + nro_size, bss_address, bss_size,
|
.MirrorMemory(*map_address + nro_size, bss_address, bss_size,
|
||||||
Kernel::MemoryState::ModuleCode)
|
Kernel::MemoryState::ModuleCodeData)
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
ASSERT(vm_manager.ReprotectRange(bss_address, bss_size, Kernel::VMAPermission::None)
|
ASSERT(vm_manager.ReprotectRange(bss_address, bss_size, Kernel::VMAPermission::None)
|
||||||
.IsSuccess());
|
.IsSuccess());
|
||||||
|
|
Loading…
Reference in a new issue