From d768714a4acca69e852eb41483d0d0c7ee82f72a Mon Sep 17 00:00:00 2001 From: Antonio Date: Tue, 20 Aug 2024 14:33:59 -0400 Subject: [PATCH] '' --- src/core/address_space.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/core/address_space.cpp b/src/core/address_space.cpp index 410759fc..3c65010e 100644 --- a/src/core/address_space.cpp +++ b/src/core/address_space.cpp @@ -232,16 +232,9 @@ struct AddressSpace::Impl { LOG_CRITICAL(Common_Memory, "Unsupported protection flag combination"); } - const VAddr virtual_end = virtual_addr + size; - auto [it, end] = placeholders.equal_range({virtual_addr, virtual_end}); - while (it != end) { - const size_t offset = std::max(it->lower(), virtual_addr); - const size_t protect_length = std::min(it->upper(), virtual_end) - offset; - DWORD old_flags{}; - if (!VirtualProtect(virtual_base + offset, protect_length, new_flags, &old_flags)) { - LOG_CRITICAL(Common_Memory, "Failed to change virtual memory protect rules"); - } - ++it; + DWORD old_flags{}; + if (!VirtualProtect(reinterpret_cast(virtual_addr), size, new_flags, &old_flags)) { + LOG_CRITICAL(Common_Memory, "Failed to change virtual memory protection"); } }