summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Liam2024-01-19 19:37:25 -0500
committerGravatar Liam2024-01-22 21:18:52 -0500
commit96833cd809399c46bc9542e4e39b86cc496a6831 (patch)
tree66478fa6335abea2f6c221bf068468c6ef7f86f7 /src
parentMerge pull request #12753 from liamwhite/why (diff)
downloadyuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.gz
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.xz
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.zip
kernel: target invalidate to given process
Diffstat (limited to 'src')
-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 3f0a39d33..1dd86fb3c 100644
--- a/src/core/hle/kernel/k_page_table_base.cpp
+++ b/src/core/hle/kernel/k_page_table_base.cpp
@@ -69,9 +69,14 @@ public:
69}; 69};
70 70
71template <typename AddressType> 71template <typename AddressType>
72void InvalidateInstructionCache(KernelCore& kernel, AddressType addr, u64 size) { 72void InvalidateInstructionCache(KernelCore& kernel, KPageTableBase* table, AddressType addr,
73 u64 size) {
73 // TODO: lock the process list 74 // TODO: lock the process list
74 for (auto& process : kernel.GetProcessList()) { 75 for (auto& process : kernel.GetProcessList()) {
76 if (std::addressof(process->GetPageTable().GetBasePageTable()) != table) {
77 continue;
78 }
79
75 for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { 80 for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) {
76 auto* interface = process->GetArmInterface(i); 81 auto* interface = process->GetArmInterface(i);
77 if (interface) { 82 if (interface) {
@@ -1302,7 +1307,7 @@ Result KPageTableBase::UnmapCodeMemory(KProcessAddress dst_address, KProcessAddr
1302 bool reprotected_pages = false; 1307 bool reprotected_pages = false;
1303 SCOPE_EXIT({ 1308 SCOPE_EXIT({
1304 if (reprotected_pages && any_code_pages) { 1309 if (reprotected_pages && any_code_pages) {
1305 InvalidateInstructionCache(m_kernel, dst_address, size); 1310 InvalidateInstructionCache(m_kernel, this, dst_address, size);
1306 } 1311 }
1307 }); 1312 });
1308 1313
@@ -2036,7 +2041,7 @@ Result KPageTableBase::SetProcessMemoryPermission(KProcessAddress addr, size_t s
2036 for (const auto& block : pg) { 2041 for (const auto& block : pg) {
2037 StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize()); 2042 StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize());
2038 } 2043 }
2039 InvalidateInstructionCache(m_kernel, addr, size); 2044 InvalidateInstructionCache(m_kernel, this, addr, size);
2040 } 2045 }
2041 2046
2042 R_SUCCEED(); 2047 R_SUCCEED();
@@ -3277,7 +3282,7 @@ Result KPageTableBase::WriteDebugMemory(KProcessAddress dst_address, KProcessAdd
3277 R_TRY(PerformCopy()); 3282 R_TRY(PerformCopy());
3278 3283
3279 // Invalidate the instruction cache, as this svc allows modifying executable pages. 3284 // Invalidate the instruction cache, as this svc allows modifying executable pages.
3280 InvalidateInstructionCache(m_kernel, dst_address, size); 3285 InvalidateInstructionCache(m_kernel, this, dst_address, size);
3281 3286
3282 R_SUCCEED(); 3287 R_SUCCEED();
3283} 3288}