Repository navigation
xmem: a physical-page view drops PAGE_WRITECOMBINE and PAGE_NOCACHE (Wine refuses them; RT-5 boot on Proton) - #7550
ramenbellic wants to merge 1 commit into
Conversation
The retail executable reserves physical-page windows with protection 0x2404: a graphics bit plus PAGE_READWRITE | PAGE_WRITECOMBINE. host_protect keeps the write-combine modifier, and view_protect passed it to MapViewOfFile3, which refuses it on Wine with ERROR_INVALID_PARAMETER. On Linux/Proton the title's first XMemMapPhysicalPages into that window failed and its device init asserted. The views are pagefile-backed CPU mappings, so the modifier is only a caching hint; it is dropped for the view. xmem_test: a window reserved with the title's protection maps a page and its view is plain read-write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013puXaEnm3gXuUo4XsSt4g4
|
Independent Windows test of Setup: Windows 11 x64, MSVC 19.44.35220 (
AI-assisted review/test. |
|
A native-Windows reason for this change, measured on my own 1.0.2.1 copy (Windows 11, RTX 5060 Ti, NVIDIA driver, MSVC RelWithDebInfo, Without this PR, device slot 133 (#7218) falls back to an ordinary buffer: With this PR merged on top (nothing else changed), the same run creates the slot-133 buffer as a host import. There is no fallback line and no probe hit, and the boot reaches the same next stop (heap slot 9, stop 13). So the cache modifier matters for #7218's import on Windows/NVIDIA as well as for |
|
Tested
AI-assisted (Claude Code). |
…E_WRITECOMBINE and PAGE_NOCACHE (Wine refuses them; RT-5 boot on Proton) Squashed from ProjectLeonida#7550 by ramenbellic, head 95df4e2 (security scan PASS).
… one view, so the retail boot's 100,000-page XMemMapPhysicalPages fits the title's hang watchdog under Wine Squashed from ItsNotRexed#7584 by gkissel, head 5ba2a7f (security scan PASS). Merged cleanly on top of ItsNotRexed#7550 (view_protect still feeds the view's protection). Added the fix from the PR's review (dotaku22): after a partial unmap a guest run spans several host placeholders, and mapping the whole run again failed with ERROR_INVALID_PARAMETER; map_view now maps one view per placeholder. xmem_test gains that re-map check, which failed under Wine 11.22 before the fix and passes after (189 checks).
…ts window's PAGE_NOACCESS Squashed from ProjectLeonida#7693 by lisboon, head c54e232 (security scan PASS). Conflict: view_protect, which ProjectLeonida#7550 changed to drop PAGE_WRITECOMBINE/PAGE_NOCACHE (and kept PAGE_NOACCESS -> PAGE_READWRITE). Kept both intents: the window's protection is returned as is (a 0x801 window maps PAGE_NOACCESS, ProjectLeonida#7693) minus the cache modifiers (ProjectLeonida#7550). xmem_test under Wine 11.22: 600 checks OK, including both PRs' cases.
Claimed in the coordination issue: #7333 (comment) (new RT item, RT-5 follow-up of #6919)
Depends on: none (applies to
main; follow-up of #6919, which is merged).Problem
The retail executable reserves some physical-page windows with protection
0x2404: a graphics bit plusPAGE_READWRITE | PAGE_WRITECOMBINE.host_protectdrops only thePAGE_GRAPHICS_*bits (0x800–0x40000), so the window keepsPAGE_WRITECOMBINE.view_protectpasses that toMapViewOfFile3, which refuses it on Wine withERROR_INVALID_PARAMETER.Under
gta6rt --runon Linux/Proton, the title's firstXMemMapPhysicalPagesinto that window (752 pages) fails. The title then unmaps its other ranges, its device init returns false and it asserts. That ends every Wine/Proton boot before the descriptor heaps. Measured on #6919's head before it merged: #6919 (comment)Fix
view_protectdropsPAGE_WRITECOMBINEandPAGE_NOCACHE. These views are pagefile-backed CPU mappings, so the modifier is only a caching hint. Nothing else changes; aPAGE_NOACCESSwindow still maps read-write as before.Tested
Linux, Proton Experimental (wine 11.0),
runtimecross-built with clang-cl 23.1.6 + xwin SDK 10.0.26100 (RelWithDebInfo), RTX 3070 (driver 620.70.06):xmem_test: a new case reserves a window with the title's protection, maps a page into it and checks that the view is plain read-write. Without the fix it fails on Wine (2 failures); with the fix,OK (177 checks).ctest -R 'xmem|run_tiny_game|title_memory|loader': 14/15 pass.run_tiny_game_abort_exit_codesfails onmainwithout this change too, on the same Wine.XMemMapPhysicalPagescalls succeed (752, 1600, 160, 16 and 432 pages). The boot goes on to the descriptor heaps and device slot 70 (stop 14 in docs/retail_boot_chain.md: stops 13-17 (descriptor heap at an address, device slots 70, 127, 25) #6982), with 1,198 D3D12 calls.Not run on Windows. Dropping the modifier there changes nothing but the caching hint of a CPU view.
AI-assisted (Claude Code).
🤖 Generated with Claude Code