mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-24 15:50:29 +01:00
kern: flush memory before reading in KPageTableBase::ReadDebugMemory
This commit is contained in:
parent
1fce7b08b1
commit
561a16a348
@ -2198,7 +2198,9 @@ namespace ams::kern {
|
|||||||
/* Copy as much aligned data as we can. */
|
/* Copy as much aligned data as we can. */
|
||||||
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::CopyMemoryToUserAligned32Bit(buffer, GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), copy_size), svc::ResultInvalidPointer());
|
const void * copy_src = GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr));
|
||||||
|
cpu::FlushDataCache(copy_src, copy_size);
|
||||||
|
R_UNLESS(UserspaceAccess::CopyMemoryToUserAligned32Bit(buffer, copy_src, copy_size), svc::ResultInvalidPointer());
|
||||||
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;
|
||||||
@ -2206,7 +2208,9 @@ namespace ams::kern {
|
|||||||
|
|
||||||
/* Copy remaining data. */
|
/* Copy remaining data. */
|
||||||
if (cur_size > 0) {
|
if (cur_size > 0) {
|
||||||
R_UNLESS(UserspaceAccess::CopyMemoryToUser(buffer, GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr)), cur_size), svc::ResultInvalidPointer());
|
const void * copy_src = GetVoidPointer(GetLinearMappedVirtualAddress(cur_addr));
|
||||||
|
cpu::FlushDataCache(copy_src, cur_size);
|
||||||
|
R_UNLESS(UserspaceAccess::CopyMemoryToUser(buffer, copy_src, cur_size), svc::ResultInvalidPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
Loading…
Reference in New Issue
Block a user