Skip to content

xmem: drop cache modifiers before mapping a physical page - #7499

Closed
JohannFaust666 wants to merge 1 commit into
ProjectLeonida:mainfrom
JohannFaust666:xmem-drop-view-cache-modifiers
Closed

JohannFaust666 wants to merge 1 commit into
ProjectLeonida:mainfrom
JohannFaust666:xmem-drop-view-cache-modifiers

Conversation

@JohannFaust666

@JohannFaust666 JohannFaust666 commented Nov 23, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: #7333 (comment)

Fixes #7498

What and why

view_protect passed PAGE_WRITECOMBINE through to MapViewOfFile3. Wine rejects that modifier with ERROR_INVALID_PARAMETER. The descriptor-pool window is reserved PAGE_READWRITE | PAGE_WRITECOMBINE, so the first XMemMapPhysicalPages into it fails and device init stops. Windows treats the bit as a caching hint on these pagefile-backed views. The mask is dropped before the map; PAGE_NOACCESS still becomes PAGE_READWRITE, as before.

Tested

xmem_test was not run here: this machine has no MSVC, clang-cl or Wine. The new check reserves a write-combined window, maps one page and requires the view to be PAGE_READWRITE without PAGE_WRITECOMBINE or PAGE_NOCACHE. The failure and this mask were measured on Wine in #6919.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (no translator change)

MapViewOfFile3 on Wine rejects PAGE_WRITECOMBINE, and the descriptor-pool window is reserved with that bit, so the first map fails and device init stops.
@thehollowedone

Copy link
Copy Markdown

Independent native Windows check of ebab9229 on Windows x64 with MSVC 19.44.35230 and Windows SDK 10.0.26100.0.

I ran xmem_test with execution limited to the new synthetic case. All four checks passed. The test reserved a 64 KiB write-combined region, allocated and mapped one page, and confirmed with VirtualQuery that the mapped view was committed and read-write, with neither cache modifier set.

This covers native Windows. AI-assisted.

@Marukooh

Copy link
Copy Markdown
Contributor

Live confirmation on Wine 11.22 + RTX 5070 Ti (environment below).

Environment: CachyOS, Wine 11.22, RTX 5070 Ti / NVIDIA 620.73.04, Vulkan 1.4.357, clang-cl 23.1.5 + xwin SDK 10.0.26100, Release, LEONIDA_D3D12=vulkan, network blocked, own 1.0.2.1 copy. Boot stack: main 86a7807 + #7411, #7110, #7076, #7066, #6954, #6582, #4348, #7216, #4313, #7499, #7516 (PR heads merged, conflicts resolved locally). AI-assisted (Claude Code).

@skorex

skorex commented Nov 23, 2026

Copy link
Copy Markdown

Duplicate of #7492

#7492 makes the same change and was opened earlier. Topic: xmem: a physical-page view drops PAGE_WRITECOMBINE and PAGE_NOCACHE from the window protection.

Suggest closing this PR in favour of #7492, and porting anything this one adds that #7492 lacks there.

@JohannFaust666

Copy link
Copy Markdown
Author

Closing in favour of #7492. It changes the same line, adds the same kind of test, and was opened first. The Windows run of this test and the Wine boot that gets past the descriptor-pool map are on this thread; they apply to #7492 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xmem: mapping a PAGE_WRITECOMBINE window fails on Wine

4 participants