summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-04-03 16:14:56 +0200
committerGitHub <noreply@github.com>2020-04-03 16:14:56 +0200
commit9d8886b1a4327cfb35e222a3bb7c50ca32382090 (patch)
treed32e0f35df3a77661cb542445acb51e200d49ec6
parentMerge pull request #3595 from ReinUsesLisp/c4715-silence (diff)
parentservices: ldr: Fix MemoryState for read/write regions of NROs. (diff)
downloadyuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.tar
yuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.tar.gz
yuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.tar.bz2
yuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.tar.lz
yuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.tar.xz
yuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.tar.zst
yuzu-9d8886b1a4327cfb35e222a3bb7c50ca32382090.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/ldr/ldr.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp
index 157aeec88..647943020 100644
--- a/src/core/hle/service/ldr/ldr.cpp
+++ b/src/core/hle/service/ldr/ldr.cpp
@@ -342,17 +342,27 @@ public:
return;
}
- ASSERT(
- vm_manager
- .MirrorMemory(*map_address, nro_address, nro_size, Kernel::MemoryState::ModuleCode)
- .IsSuccess());
+ // Mark text and read-only region as ModuleCode
+ ASSERT(vm_manager
+ .MirrorMemory(*map_address, nro_address, header.text_size + header.ro_size,
+ 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)
.IsSuccess());
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
.MirrorMemory(*map_address + nro_size, bss_address, bss_size,
- Kernel::MemoryState::ModuleCode)
+ Kernel::MemoryState::ModuleCodeData)
.IsSuccess());
ASSERT(vm_manager.ReprotectRange(bss_address, bss_size, Kernel::VMAPermission::None)
.IsSuccess());