mirror of https://git.suyu.dev/suyu/suyu
k_page_table: use more precise icache invalidates
This commit is contained in:
parent
2a255b2d61
commit
b16fefa106
|
@ -72,6 +72,11 @@ void InvalidateEntireInstructionCache(Core::System& system) {
|
||||||
system.InvalidateCpuInstructionCaches();
|
system.InvalidateCpuInstructionCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename AddressType>
|
||||||
|
void InvalidateInstructionCache(Core::System& system, AddressType addr, u64 size) {
|
||||||
|
system.InvalidateCpuInstructionCacheRange(GetInteger(addr), size);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename AddressType>
|
template <typename AddressType>
|
||||||
Result InvalidateDataCache(AddressType addr, u64 size) {
|
Result InvalidateDataCache(AddressType addr, u64 size) {
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -1245,7 +1250,7 @@ Result KPageTableBase::UnmapCodeMemory(KProcessAddress dst_address, KProcessAddr
|
||||||
bool reprotected_pages = false;
|
bool reprotected_pages = false;
|
||||||
SCOPE_EXIT({
|
SCOPE_EXIT({
|
||||||
if (reprotected_pages && any_code_pages) {
|
if (reprotected_pages && any_code_pages) {
|
||||||
InvalidateEntireInstructionCache(m_system);
|
InvalidateInstructionCache(m_system, dst_address, size);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1981,7 +1986,7 @@ Result KPageTableBase::SetProcessMemoryPermission(KProcessAddress addr, size_t s
|
||||||
for (const auto& block : pg) {
|
for (const auto& block : pg) {
|
||||||
StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize());
|
StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize());
|
||||||
}
|
}
|
||||||
InvalidateEntireInstructionCache(m_system);
|
InvalidateInstructionCache(m_system, addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
|
@ -3222,8 +3227,8 @@ Result KPageTableBase::WriteDebugMemory(KProcessAddress dst_address, KProcessAdd
|
||||||
// Perform copy for the last block.
|
// Perform copy for the last block.
|
||||||
R_TRY(PerformCopy());
|
R_TRY(PerformCopy());
|
||||||
|
|
||||||
// Invalidate the entire instruction cache, as this svc allows modifying executable pages.
|
// Invalidate the instruction cache, as this svc allows modifying executable pages.
|
||||||
InvalidateEntireInstructionCache(m_system);
|
InvalidateInstructionCache(m_system, dst_address, size);
|
||||||
|
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue