Fix vm::check_addr usage

This commit is contained in:
Nekotekina 2018-04-01 22:13:56 +03:00
parent d871675b3b
commit 402ca480cd
3 changed files with 5 additions and 5 deletions

View File

@ -540,7 +540,7 @@ bool GDBDebugServer::cmd_read_memory(gdb_cmd & cmd)
std::string result;
result.reserve(len * 2);
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr, 1, vm::page_info_t::page_readable)) {
if (vm::check_addr(addr, 1, vm::page_allocated | vm::page_readable)) {
result += to_hexbyte(vm::read8(addr + i));
} else {
break;
@ -566,7 +566,7 @@ bool GDBDebugServer::cmd_write_memory(gdb_cmd & cmd)
u32 len = hex_to_u32(cmd.data.substr(s + 1, s2 - s - 1));
const char* data_ptr = (cmd.data.c_str()) + s2 + 1;
for (u32 i = 0; i < len; ++i) {
if (vm::check_addr(addr + i, 1, vm::page_info_t::page_writable)) {
if (vm::check_addr(addr + i, 1, vm::page_allocated | vm::page_writable)) {
u8 val;
int res = sscanf_s(data_ptr, "%02hhX", &val);
if (!res) {

View File

@ -489,12 +489,12 @@ std::string ppu_thread::dump() const
u32 stack_min = stack_ptr & ~0xfff;
u32 stack_max = stack_min + 4096;
while (stack_min && vm::check_addr(stack_min - 4096, 4096, vm::page_writable))
while (stack_min && vm::check_addr(stack_min - 4096, 4096, vm::page_allocated | vm::page_writable))
{
stack_min -= 4096;
}
while (stack_max + 4096 && vm::check_addr(stack_max, 4096, vm::page_writable))
while (stack_max + 4096 && vm::check_addr(stack_max, 4096, vm::page_allocated | vm::page_writable))
{
stack_max += 4096;
}

View File

@ -14,7 +14,7 @@ error_code sys_gpio_get(u64 device_id, vm::ptr<u64> value)
return CELL_ESRCH;
}
if (!vm::check_addr(value.addr(), sizeof(u64), vm::page_writable))
if (!vm::check_addr(value.addr(), sizeof(u64), vm::page_allocated | vm::page_writable))
{
return CELL_EFAULT;
}