summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_page_table.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-04-12 20:23:20 +0200
committerGitHub <noreply@github.com>2022-04-12 20:23:20 +0200
commitdc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a (patch)
tree88f18cf06c71fd6be128080683406c617d42daca /src/core/hle/kernel/k_page_table.cpp
parentMerge pull request #8157 from lat9nq/kernel-races (diff)
parenthle: kernel: Invalidate entire icache in UnmapProcessMemory and UnmapCodeMemory (fixes #8174) (diff)
downloadyuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.tar
yuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.tar.gz
yuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.tar.bz2
yuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.tar.lz
yuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.tar.xz
yuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.tar.zst
yuzu-dc2dd5d5a6a7f60cf12788af6ae92f51cb8e5c0a.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_page_table.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/core/hle/kernel/k_page_table.cpp b/src/core/hle/kernel/k_page_table.cpp
index 599013cf6..47ea3c89c 100644
--- a/src/core/hle/kernel/k_page_table.cpp
+++ b/src/core/hle/kernel/k_page_table.cpp
@@ -346,7 +346,8 @@ ResultCode KPageTable::MapCodeMemory(VAddr dst_address, VAddr src_address, std::
return ResultSuccess;
}
-ResultCode KPageTable::UnmapCodeMemory(VAddr dst_address, VAddr src_address, std::size_t size) {
+ResultCode KPageTable::UnmapCodeMemory(VAddr dst_address, VAddr src_address, std::size_t size,
+ ICacheInvalidationStrategy icache_invalidation_strategy) {
// Validate the mapping request.
R_UNLESS(this->CanContain(dst_address, size, KMemoryState::AliasCode),
ResultInvalidMemoryRegion);
@@ -396,7 +397,11 @@ ResultCode KPageTable::UnmapCodeMemory(VAddr dst_address, VAddr src_address, std
bool reprotected_pages = false;
SCOPE_EXIT({
if (reprotected_pages && any_code_pages) {
- system.InvalidateCpuInstructionCacheRange(dst_address, size);
+ if (icache_invalidation_strategy == ICacheInvalidationStrategy::InvalidateRange) {
+ system.InvalidateCpuInstructionCacheRange(dst_address, size);
+ } else {
+ system.InvalidateCpuInstructionCaches();
+ }
}
});
@@ -563,6 +568,8 @@ ResultCode KPageTable::UnmapProcessMemory(VAddr dst_addr, std::size_t size,
block_manager->Update(dst_addr, num_pages, KMemoryState::Free, KMemoryPermission::None,
KMemoryAttribute::None);
+ system.InvalidateCpuInstructionCaches();
+
return ResultSuccess;
}