summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_process.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-11-17 22:44:53 +0100
committert895 <clombardo169@gmail.com>2023-11-25 06:46:47 +0100
commit9f91ba1f7357c61dd2c7c3b437ea203d467fd400 (patch)
tree3cfe55acf5d2f8a0d75373934b4c22a4e9bb2a09 /src/core/hle/kernel/k_process.cpp
parentdevice_memory: Enable direct mapped addresses for nce (diff)
downloadyuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.tar
yuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.tar.gz
yuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.tar.bz2
yuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.tar.lz
yuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.tar.xz
yuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.tar.zst
yuzu-9f91ba1f7357c61dd2c7c3b437ea203d467fd400.zip
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
-rw-r--r--src/core/hle/kernel/k_process.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index c6a200320..d2e9f2a2e 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -1214,6 +1214,17 @@ void KProcess::LoadModule(CodeSet code_set, KProcessAddress base_addr) {
ReprotectSegment(code_set.CodeSegment(), Svc::MemoryPermission::ReadExecute);
ReprotectSegment(code_set.RODataSegment(), Svc::MemoryPermission::Read);
ReprotectSegment(code_set.DataSegment(), Svc::MemoryPermission::ReadWrite);
+
+#ifdef ARCHITECTURE_arm64
+ if (Settings::IsNceEnabled()) {
+ auto& buffer = m_kernel.System().DeviceMemory().buffer;
+ const auto& code = code_set.CodeSegment();
+ const auto& patch = code_set.PatchSegment();
+ buffer.Protect(GetInteger(base_addr + code.addr), code.size, true, true, true);
+ buffer.Protect(GetInteger(base_addr + patch.addr), patch.size, true, true, true);
+ ReprotectSegment(code_set.PatchSegment(), Svc::MemoryPermission::None);
+ }
+#endif
}
bool KProcess::InsertWatchpoint(KProcessAddress addr, u64 size, DebugWatchpointType type) {