mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-15 03:27:49 +01:00
kern: KPageTableBase::WriteDebugMemory stores/invalidates cache
This commit is contained in:
parent
b5f2698bf0
commit
595c6dbe8f
@ -2157,6 +2157,8 @@ namespace ams::kern {
|
|||||||
if (cur_size >= sizeof(u32)) {
|
if (cur_size >= sizeof(u32)) {
|
||||||
const size_t copy_size = util::AlignDown(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());
|
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);
|
buffer = reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(buffer) + copy_size);
|
||||||
cur_addr += copy_size;
|
cur_addr += copy_size;
|
||||||
cur_size -= copy_size;
|
cur_size -= copy_size;
|
||||||
@ -2165,6 +2167,7 @@ namespace ams::kern {
|
|||||||
/* Copy remaining data. */
|
/* Copy remaining data. */
|
||||||
if (cur_size > 0) {
|
if (cur_size > 0) {
|
||||||
R_UNLESS(UserspaceAccess::CopyMemoryFromUser(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), buffer, cur_size), svc::ResultInvalidCurrentMemory());
|
R_UNLESS(UserspaceAccess::CopyMemoryFromUser(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), buffer, cur_size), svc::ResultInvalidCurrentMemory());
|
||||||
|
cpu::StoreDataCache(GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), copy_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
@ -2200,6 +2203,9 @@ namespace ams::kern {
|
|||||||
/* 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. */
|
||||||
|
cpu::InvalidateEntireInstructionCache();
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user