mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +00:00
kern: KPageTableBase::WriteDebugMemory stores/invalidates cache
This commit is contained in:
parent
b5f2698bf0
commit
595c6dbe8f
1 changed files with 6 additions and 0 deletions
|
@ -2157,6 +2157,8 @@ namespace ams::kern {
|
|||
if (cur_size >= sizeof(u32)) {
|
||||
const size_t copy_size = util::AlignDown(cur_size, sizeof(u32));
|
||||
R_UNLESS(UserspaceAccess::CopyMemoryFromUserAligned32Bit(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), buffer, copy_size), svc::ResultInvalidCurrentMemory());
|
||||
cpu::StoreDataCache(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), copy_size);
|
||||
|
||||
buffer = reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(buffer) + copy_size);
|
||||
cur_addr += copy_size;
|
||||
cur_size -= copy_size;
|
||||
|
@ -2165,6 +2167,7 @@ namespace ams::kern {
|
|||
/* Copy remaining data. */
|
||||
if (cur_size > 0) {
|
||||
R_UNLESS(UserspaceAccess::CopyMemoryFromUser(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), buffer, cur_size), svc::ResultInvalidCurrentMemory());
|
||||
cpu::StoreDataCache(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), copy_size);
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
|
@ -2200,6 +2203,9 @@ namespace ams::kern {
|
|||
/* Perform copy for the last block. */
|
||||
R_TRY(PerformCopy());
|
||||
|
||||
/* Invalidate the entire instruction cache, as this svc allows modifying executable pages. */
|
||||
cpu::InvalidateEntireInstructionCache();
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue