summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/hle/kernel/k_page_table_base.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp
index 1cc019c06..c97b4a6b7 100644
--- a/src/core/hle/kernel/k_page_table_base.cpp
+++ b/src/core/hle/kernel/k_page_table_base.cpp
@@ -73,6 +73,11 @@ void InvalidateEntireInstructionCache(Core::System& system) {
73} 73}
74 74
75template <typename AddressType> 75template <typename AddressType>
76void InvalidateInstructionCache(Core::System& system, AddressType addr, u64 size) {
77 system.InvalidateCpuInstructionCacheRange(GetInteger(addr), size);
78}
79
80template <typename AddressType>
76Result InvalidateDataCache(AddressType addr, u64 size) { 81Result InvalidateDataCache(AddressType addr, u64 size) {
77 R_SUCCEED(); 82 R_SUCCEED();
78} 83}
@@ -1245,7 +1250,7 @@ Result KPageTableBase::UnmapCodeMemory(KProcessAddress dst_address, KProcessAddr
1245 bool reprotected_pages = false; 1250 bool reprotected_pages = false;
1246 SCOPE_EXIT({ 1251 SCOPE_EXIT({
1247 if (reprotected_pages && any_code_pages) { 1252 if (reprotected_pages && any_code_pages) {
1248 InvalidateEntireInstructionCache(m_system); 1253 InvalidateInstructionCache(m_system, dst_address, size);
1249 } 1254 }
1250 }); 1255 });
1251 1256
@@ -1981,7 +1986,7 @@ Result KPageTableBase::SetProcessMemoryPermission(KProcessAddress addr, size_t s
1981 for (const auto& block : pg) { 1986 for (const auto& block : pg) {
1982 StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize()); 1987 StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize());
1983 } 1988 }
1984 InvalidateEntireInstructionCache(m_system); 1989 InvalidateInstructionCache(m_system, addr, size);
1985 } 1990 }
1986 1991
1987 R_SUCCEED(); 1992 R_SUCCEED();
@@ -3222,8 +3227,8 @@ Result KPageTableBase::WriteDebugMemory(KProcessAddress dst_address, KProcessAdd
3222 // Perform copy for the last block. 3227 // Perform copy for the last block.
3223 R_TRY(PerformCopy()); 3228 R_TRY(PerformCopy());
3224 3229
3225 // Invalidate the entire instruction cache, as this svc allows modifying executable pages. 3230 // Invalidate the instruction cache, as this svc allows modifying executable pages.
3226 InvalidateEntireInstructionCache(m_system); 3231 InvalidateInstructionCache(m_system, dst_address, size);
3227 3232
3228 R_SUCCEED(); 3233 R_SUCCEED();
3229} 3234}