rx/map: simplify protection conversion for windows
Some checks are pending
Formatting check / formatting-check (push) Waiting to run
Build RPCSX / build-linux (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.1-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.2-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.4-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv8.5-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9-a) (push) Waiting to run
Build RPCSX / build-android (arm64-v8a, armv9.1-a) (push) Waiting to run
Build RPCSX / build-android (x86_64, x86-64) (push) Waiting to run

This commit is contained in:
DH 2025-10-16 12:14:26 +03:00
parent 94a8724403
commit 0bc167ea87

View file

@ -122,22 +122,20 @@ std::errc rx::Mappable::map(rx::AddressRange virtualRange, std::size_t offset,
rx::EnumBitSet<Protection> protection, rx::EnumBitSet<Protection> protection,
[[maybe_unused]] std::size_t alignment) { [[maybe_unused]] std::size_t alignment) {
#ifdef _WIN32 #ifdef _WIN32
DWORD prot = 0; static const DWORD protTable[] = {
if (!protection) { PAGE_NOACCESS, // 0
prot = PAGE_NOACCESS; PAGE_READONLY, // R
} else if (protection == Protection::R) { PAGE_EXECUTE_READWRITE, // W
prot = PAGE_READONLY; PAGE_EXECUTE_READWRITE, // RW
} else if (protection & Protection::X) { PAGE_EXECUTE, // X
if (protection & Protection::W) { PAGE_EXECUTE_READWRITE, // XR
prot = PAGE_EXECUTE_READWRITE; PAGE_EXECUTE_READWRITE, // XW
} else if (protection & Protection::R) { PAGE_EXECUTE_READWRITE, // XRW
prot = PAGE_EXECUTE_READ; };
} else {
prot = PAGE_EXECUTE; auto prot =
} protTable[(protection & (Protection::R | Protection::W | Protection::X))
} else { .toUnderlying()];
prot = PAGE_READWRITE;
}
releaseVirtualSpace(virtualRange, alignment); releaseVirtualSpace(virtualRange, alignment);