mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
os: fix minor bug (and simplify) MapProcessCodeMemory
This commit is contained in:
parent
c2c0a2e169
commit
b1367942a2
1 changed files with 1 additions and 4 deletions
|
@ -81,7 +81,7 @@ namespace ams::os::impl {
|
||||||
/* Check if the process memory is invalid. */
|
/* Check if the process memory is invalid. */
|
||||||
const u64 last_address = regions[i].address + regions[i].size - 1;
|
const u64 last_address = regions[i].address + regions[i].size - 1;
|
||||||
u64 cur_address = regions[i].address;
|
u64 cur_address = regions[i].address;
|
||||||
while (true) {
|
while (cur_address <= last_address) {
|
||||||
svc::MemoryInfo memory_info;
|
svc::MemoryInfo memory_info;
|
||||||
svc::PageInfo page_info;
|
svc::PageInfo page_info;
|
||||||
R_ABORT_UNLESS(svc::QueryProcessMemory(std::addressof(memory_info), std::addressof(page_info), handle, cur_address));
|
R_ABORT_UNLESS(svc::QueryProcessMemory(std::addressof(memory_info), std::addressof(page_info), handle, cur_address));
|
||||||
|
@ -91,9 +91,6 @@ namespace ams::os::impl {
|
||||||
R_UNLESS(memory_info.attribute == static_cast<svc::MemoryAttribute>(0), os::ResultInvalidProcessMemory());
|
R_UNLESS(memory_info.attribute == static_cast<svc::MemoryAttribute>(0), os::ResultInvalidProcessMemory());
|
||||||
|
|
||||||
cur_address = memory_info.base_address + memory_info.size;
|
cur_address = memory_info.base_address + memory_info.size;
|
||||||
if (cur_address > last_address) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
R_THROW(os::ResultInvalidCurrentMemoryState());
|
R_THROW(os::ResultInvalidCurrentMemoryState());
|
||||||
|
|
Loading…
Reference in a new issue