1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00

vm: respect initial protection for allocation mapping

Unused yet.
This commit is contained in:
Nekotekina 2020-11-17 05:08:20 +03:00
parent ea5f5aea5f
commit d7e1cf7dd2

View File

@ -733,11 +733,17 @@ namespace vm
rsxthr->on_notify_memory_mapped(addr, size); rsxthr->on_notify_memory_mapped(addr, size);
} }
auto prot = utils::protection::rw;
if (~flags & page_writable)
prot = utils::protection::ro;
if (~flags & page_readable)
prot = utils::protection::no;
if (!shm) if (!shm)
{ {
utils::memory_protect(g_base_addr + addr, size, utils::protection::rw); utils::memory_protect(g_base_addr + addr, size, prot);
} }
else if (shm->map_critical(g_base_addr + addr) != g_base_addr + addr || shm->map_critical(g_sudo_addr + addr) != g_sudo_addr + addr) else if (shm->map_critical(g_base_addr + addr, prot) != g_base_addr + addr || shm->map_critical(g_sudo_addr + addr) != g_sudo_addr + addr)
{ {
fmt::throw_exception("Memory mapping failed - blame Windows (addr=0x%x, size=0x%x, flags=0x%x)", addr, size, flags); fmt::throw_exception("Memory mapping failed - blame Windows (addr=0x%x, size=0x%x, flags=0x%x)", addr, size, flags);
} }