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,
[[maybe_unused]] std::size_t alignment) {
#ifdef _WIN32
DWORD prot = 0;
if (!protection) {
prot = PAGE_NOACCESS;
} else if (protection == Protection::R) {
prot = PAGE_READONLY;
} else if (protection & Protection::X) {
if (protection & Protection::W) {
prot = PAGE_EXECUTE_READWRITE;
} else if (protection & Protection::R) {
prot = PAGE_EXECUTE_READ;
} else {
prot = PAGE_EXECUTE;
}
} else {
prot = PAGE_READWRITE;
}
static const DWORD protTable[] = {
PAGE_NOACCESS, // 0
PAGE_READONLY, // R
PAGE_EXECUTE_READWRITE, // W
PAGE_EXECUTE_READWRITE, // RW
PAGE_EXECUTE, // X
PAGE_EXECUTE_READWRITE, // XR
PAGE_EXECUTE_READWRITE, // XW
PAGE_EXECUTE_READWRITE, // XRW
};
auto prot =
protTable[(protection & (Protection::R | Protection::W | Protection::X))
.toUnderlying()];
releaseVirtualSpace(virtualRange, alignment);