upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/xmem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/shims/xmem.cpp')
-rw-r--r--runtime/shims/xmem.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/shims/xmem.cpp b/runtime/shims/xmem.cpp
index 37f29459f..27c86cfa9 100644
--- a/runtime/shims/xmem.cpp
+++ b/runtime/shims/xmem.cpp
@@ -460,7 +460,10 @@ bool map_page(uintptr_t address, uint64_t page, DWORD protect) {
460// Two of the measured windows are reserved PAGE_NOACCESS for the CPU and the GPU alike; pages mapped there are still 460// Two of the measured windows are reserved PAGE_NOACCESS for the CPU and the GPU alike; pages mapped there are still
461// GPU memory, which the D3D12 layer reads on the CPU. 461// GPU memory, which the D3D12 layer reads on the CPU.
462DWORD view_protect(const Window& window) { 462DWORD view_protect(const Window& window) {
463 return window.protect == PAGE_NOACCESS ? PAGE_READWRITE : window.protect; 463 // A view takes no cache modifier: MapViewOfFile3 refuses PAGE_WRITECOMBINE (0x400, which three of the measured
464 // windows carry next to PAGE_READWRITE) and PAGE_NOCACHE with ERROR_INVALID_PARAMETER.
465 const DWORD protect = window.protect & ~static_cast<DWORD>(PAGE_WRITECOMBINE | PAGE_NOCACHE | PAGE_GUARD);
466 return protect == PAGE_NOACCESS ? PAGE_READWRITE : protect;
464} 467}
465 468
466bool aligned_page_address(uintptr_t address) { return (address & (kPhysicalPageSize - 1)) == 0; } 469bool aligned_page_address(uintptr_t address) { return (address & (kPhysicalPageSize - 1)) == 0; }