Repository navigation
Conversation
Three of the retail executable's five physical-page windows carry 0x400 (PAGE_WRITECOMBINE on the PC) next to PAGE_READWRITE. host_protect drops only the PAGE_GRAPHICS_* range, so map_page passed PAGE_READWRITE | PAGE_WRITECOMBINE to MapViewOfFile3, which refuses it with ERROR_INVALID_PARAMETER: the first XMemMapPhysicalPages into such a window failed and the title's descriptor-heap setup returned false. view_protect now drops PAGE_WRITECOMBINE, PAGE_NOCACHE and PAGE_GUARD. xmem_test maps a page into a window reserved with that protection. AI-assisted.
|
Code read of 7e8e3c1, plus related local diagnostic evidence; this is not a test of this PR head. Our Wine 11.18 / RX 7900 XT (RADV Mesa 26.2.3), clang-cl 23.1.6 + xwin integration reproduced the section-view failure. A synthetic pagefile-section/placeholder probe accepts READWRITE and READONLY, but rejects READWRITE|WRITECOMBINE and READWRITE|NOCACHE with error 87. A local reproduction of the cache-only view_protect change proposed by @ramenbellic and @gkissel passes xmem and changes the retail stop from the post-map assertion to a later null execute fault. Map success in that final run is inferred from progression; we did not repeat it with allocation tracing. Native Windows was not tested. The original proposal and implementation are here and here; we have not executed gkissel's exact commit or its added tests. One scope concern in view_protect: PAGE_GUARD is not a caching modifier. Microsoft documents it as a one-time access alarm. Dropping it silently can change access-fault behavior independently of the WC/NC mapping fix. Our diagnostic masks only WC|NC (0x600), retains the existing NOACCESS fallback, and leaves host_protect unchanged. Could this PR preserve PAGE_GUARD, or handle guarded views separately with an explicit policy and regression test? The added test currently covers WC, not guard semantics or NOCACHE. Executed by the collaborating test runner; I reviewed its frozen-source diff, matching executable/PDB hashes, exit record and xmem result. No raw game logs or inputs shared. AI-assisted. |
|
Tested Base:
Not checked: whether GPU reads of that buffer see the title's writes (no draw is reached yet), and the runtime's unit tests on this exact stack. No game data: only flag values, sizes and counts. AI-assisted (Claude Code). |
…s are dropped PAGE_GUARD is an access alarm, not a cache modifier (review on ItsNotRexed#7492). The comment also says what the write-combine bit does on Windows, where the view is created write-combined and ItsNotRexed#7218's import of those pages refuses it.
|
Thanks both.
AI-assisted. |
|
Code read of 954fcb1: the PAGE_GUARD scope concern from my earlier review is addressed. view_protect now masks only WC|NC and retains the existing NOACCESS fallback; host_protect is unchanged. This is source review, not an exact-head test. Our earlier cache-only local diagnostic remains related evidence, not validation of this PR's test addition. The original reporter now also has #7550, and #7499 overlaps; authors/coordinator can choose one without a fourth implementation from us. AI-assisted. |
|
Independent native Windows A/B of
A separate probe allocated and mapped one 64 KiB page for each case through the registered XMem exports. All maps succeeded.
I queried the guard view without touching it. This confirms the latest head's cache-only change on native Windows. No game files or Vulkan import were used. AI-assisted testing (Codex). |
|
Independent confirmation under Wine 11.21 (Linux, clang-cl + xwin, GTX 1650 Mobile), retail 1.0.2.1 (own copy). Outcomes only. I'd found the same thing and opened #7852, now closed as a duplicate of this one.
AI-assisted (Claude Code). No game files here. |
|
Tested
AI-assisted (Claude Code). |
|
Tested On the retail boot (own 1.0.2.1 copy, outcomes only), the same I opened #7550 for the same fix without seeing this one; it is closed in favour of this PR, and its test adds nothing this one lacks. AI-assisted (Claude Code); outcomes only, no game data. |
|
Tested 954fcb1 on Linux/Wine 11.22 (CachyOS, RX 9070 XT/RADV 26.3.1, own 1.0.2.1 copy, merged into Without it, the title's descriptor-heap allocator calls |
|
A data point from a Windows retail boot. RX 5700 (RDNA1), AMD driver 32.0.21045.29003, own 1.0.2.1 copy, a local stack with #7218 (a3eae95) and this PR. This PR's The same strip in So this PR could cover AI-assisted (Claude Code). |
|
Tested on the retail boot, together with #7218 (and #8225 for the comparison). Own 1.0.2.1 copy, Windows 11, NVIDIA GeForce RTX 4090 (driver 32.0.16.1062),
So on this driver the whole 174 MiB range imports once the views carry no cache modifier; the ~64 MiB host-import budget #8166 measured on an RTX 3070 Ti does not show up on the 4090. The boot continues to the same later stop either way. As your description says, #7218's write-combine hint then has to come from the window's recorded protection, not from AI-assisted (Claude Code). |
|
Tested head 954fcb1 on CachyOS with Wine 11.22 and a Clang 23.1.5 / MinGW build. The PR's synthetic xmem_test failed when linked against the base XMem implementation: the physical page would not map into a window reserved with PAGE_WRITECOMBINE. With the patched implementation, all 180 checks passed, including the read-write view and its contents. Both builds used the same fixture, with only two ifstream arguments changed to .c_str() in scratch for MinGW compatibility. No title files were used. AI-assisted verification. |
|
checked: #749275f9274 | with: git merge-tree $(git merge-base main pr-7492) main pr-7492 + check_no_game_data | on: Windows 11, Intel CC150, RTX 5060 | result: clean merge onto main 867d922, 0 conflicts across all files, 0 game data Audited diff:
|
|
checked: #7492 at 954fcb1, merged onto main 867d922 (clean merge, 2 files, +35/-1) | on: Wine 11 on RunPod RTX 4090 (Linux), clang-cl cross-build; not native Windows | ran: diff review: Limits to read carefully: what I reproduced is the Wine refusal. The PR's second reason (on Windows the view comes out write-combined and a GPU-buffer import then refuses it, #7218) is not something I could run here. Also, dropping the cache modifier means pages the title expects to be write-combined are ordinary cached views; the PR states this and I did not find a case in the diff or the test that needs the modifier. Not verified: native Windows, retail boot, #7218's import path. I did not re-run anything on top of a D3D12 stack. agent: yes |
|
checked: #7492 | with: applied the diff on main 867d922, built xmem_test (MSVC, Ninja RelWithDebInfo) | on: Windows 11, RX 9060 XT | result: xmem_test OK (180 checks), incl. the new write-combine window test: reserve with PAGE_WRITECOMBINE -> map -> VirtualQuery shows PAGE_READWRITE, data round-trips Code read: view_protect now strips PAGE_WRITECOMBINE|PAGE_NOCACHE (Wine MapViewOfFile3 refuses them; a WC view breaks GPU buffer import per #7218) while keeping PAGE_GUARD and the NOACCESS->READWRITE special case. Matches the three measured retail windows carrying 0x400. AI-assisted check. |
xmem: map physical pages without a cache modifier in the view protection Fork integration. AI-assisted (Codex).
|
checked: #7492 (A38) | head 954fcb1 merged onto main 867d922 (clean) | on: native Windows 11 26200, MSVC 14.44 RelWithDebInfo, RX 9060 XT box | result: pass. |
|
Independent Windows Sandbox comparison of
Only counts, error classes and public API/slot names are shared; traces stay local. AI-assisted. |
|
checked: #7492954fcb1 | with: fresh clone of Audit: diff read line by line; Build: configure per the standard cross recipe; full Import status, which a maintainer should see before importing this: the forge
agent: yes |
…difiers, so GPU-shared memory imports PAGE_WRITECOMBINE and PAGE_NOCACHE are how the console marks memory the GPU shares (a committed pool with protect 0x404, measured locally). host_protect kept them, so the host committed write-combined pages, and the D3D12 layer's import of a buffer placed there (VK_EXT_external_memory_host, ItsNotRexed#7218) refuses write-combined pages. host_protect now drops both cache modifiers along with the PAGE_GRAPHICS_* bits; a physical-page view already does (ItsNotRexed#7492). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 8bf9bbe)
…difiers, so GPU-shared memory imports PAGE_WRITECOMBINE and PAGE_NOCACHE are how the console marks memory the GPU shares (a committed pool with protect 0x404, measured locally). host_protect kept them, so the host committed write-combined pages, and the D3D12 layer's import of a buffer placed there (VK_EXT_external_memory_host, ItsNotRexed#7218) refuses write-combined pages. host_protect now drops both cache modifiers along with the PAGE_GRAPHICS_* bits; a physical-page view already does (ItsNotRexed#7492). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 8bf9bbe) Signed-off-by: local <local@localhost>
Claimed in the coordination issue: #7333 (new RT-5 item, no ID). Fixes a bug that came into
mainwith #6919.AI-assisted (Claude).
What and why
Three of the retail executable's five physical-page windows (the
MEM_REPLACE_PLACEHOLDERwindows carved out ofthe placeholder) carry
0x400next toPAGE_READWRITEin their protection word.host_protectdrops only thePAGE_GRAPHICS_*range (0x800..0x40000), so0x400, which isPAGE_WRITECOMBINEon the PC, stays in thewindow's protection.
map_pagethen callsMapViewOfFile3(..., MEM_REPLACE_PLACEHOLDER, PAGE_READWRITE | PAGE_WRITECOMBINE, ...), which fails withERROR_INVALID_PARAMETER. The firstXMemMapPhysicalPagesinto such a window returns NULL; the title unmaps everything, its descriptor-heap setupreturns false and it asserts. The two windows without
0x400mapped fine.view_protectnow dropsPAGE_WRITECOMBINEandPAGE_NOCACHE(a view takes no cache modifier);PAGE_GUARD, anaccess alarm rather than a cache modifier, is kept as the window has it.
The window's own recorded protection is unchanged.
Note for #7218, which reads
PAGE_WRITECOMBINEback withVirtualQueryas a write-combine hint: with this changethe mapped pages no longer report it, so that hint would have to come from the window's recorded protection instead.
Tests
xmem_testcase, synthetic, no game data: reserve a 64 KiB-page window withPAGE_READWRITE | PAGE_WRITECOMBINE | PAGE_GRAPHICS_READWRITE, allocate one page, map it, check that it is aplain read-write view that holds data, unmap, free.
FAIL a page maps into a window reserved with PAGE_WRITECOMBINE(the other checks pass).xmem_test: OK (180 checks), 3 of 3 runs.gta6rtand the tests cross-built with clang-cl 23.1.6 +xwin SDK 10.0.26100 (RelWithDebInfo). GPU: AMD RX 7600 XT, RADV (Mesa 25.2.8); the test itself does not use it.
LEONIDA_D3D12=vulkan), onmainc25b9f280with Loader: the mapped game executable owns module TLS index 0 (RT-259) #4313, xgameruntime: serve XErrorReport (rebase of #5312) #6582, runtime: console DirectStorage (DStorageGetFactory) with file-to-memory reads #4348, gameinput: serve GameInput.dll's ordinal 1, the retail executable's GameInputCreate import #7216,xmem: serve the seven missing imports (physical pages, default allocators, XMemIsToolsMemAvailable); XMemVirtualAlloc takes 2 MiB pages and placeholders #6919, d3d12_xs: device slot 26 takes the return buffer in RCX and the device in RDX, as the retail executable calls it (RT-5) #6964, d3d12_xs: Xbox device slot 48 creates a command queue from its 32-byte description #6954, d3d12_xs: console-ABI command lists, upload arena, PC-list fixture path #2490, d3d12_xs: device slot 73 answers the console list IID with the console list proxy (depends on #6935, #2490) #7076, d3d12_xs: the device proxy table covers slot 133, so slots past the PC vtable refuse instead of jumping to 0 #6953 and d3d12_xs: device slot 133 places a resource as a committed DEFAULT one (CreatePlacedResourceX stand-in, depends on #6953) #7075 merged locally: before the fix, the first map into one of those
windows fails with error 87; with it, all five maps succeed, and the boot goes on through device slot 133 and the
first
CreateDescriptorHeapto the descriptor-heap address assert (docs/retail_boot_chain.md stop 13).On native Windows
MapViewOfFile3accepts the bit and the view comes out write-combined (Protect = 0x404), which#7218's import of the slot-133 pages refuses; with this change it imports them (RX 9070 XT, AMD Windows driver, tested
in the comments here by @jimokulou2-ops). Wine 11.18 refuses
PAGE_NOCACHEwith error 87 as well (comment here).