runtime: test aligned committed CPU memory on Windows #974

Manually merged
github merged 1 commit from gh-pr/974/head into gh-pr/974/base 2026-11-26 22:32:19 +00:00
Owner

@⁠Jess-Doit on GitHub · 2026-11-23 19:23 UTC · original
Jess-Doit:test/xmem-committed-memory → main · +182 −0 · 3 files · 1 commits · merged 2026-11-23 19:40 UTC

Change

Refs #870. Add the aligned committed CPU memory fixture requested in the startup thread.

The fixture reserves three ordinary Windows pages at each guest alignment, 64 KiB and 2 MiB. It commits a non-page-multiple request, checks the exact commit and reserved tail with VirtualQuery, and verifies every committed byte before and after a cross-page write. It then checks that the allocation is released.

Three refusal cases cover rounding overflow, unsupported protection, and a real Win32 commit beyond the reservation. Each preserves the two live pages and the reserved tail. The host failure reaches the caller as ERROR_INVALID_ADDRESS (487).

Verification

02ebdbe on Windows 10 22H2 (19045.6456), MSVC 19.44.35230 x64, Windows SDK 10.0.26100. Both presets passed 5/5 with no skips. Each alignment committed 8,192 bytes for a 4,101-byte request, checked 8,192 zero bytes and a 16-byte cross-page pattern, and released the reservation.

foreach ($preset in 'dev','release') {
    cmake --preset $preset
    cmake --build --preset $preset --target xmem_committed_memory_check memory_query_check xmem_shim_check
    ctest --preset $preset --no-tests=error -R '^(xmem_committed_memory|desktop_memory_query|xmem_shim_(exports|physical_pages|mapped_pages))$' --output-on-failure
}
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py
git diff HEAD^ HEAD --check

The source-built mutation controls failed when the fixture allowed the unsupported protection, replaced error 487 with 87, or skipped the write at byte 4,096. The documentation and diff checks passed.

Evidence and follow-up

Original MIT-licensed source in tests/xmem_committed_memory_check.cpp. The synthetic fixture checks CPU backing through the public Win32 APIs. Its protection allowlist is fixture policy. Reserve-only XMem calls and GPU registration remain with #888 and #874. See aligned committed CPU memory for an isolated reproduction.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated the experiment documentation.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Codex).

**@⁠Jess-Doit** on GitHub · 2026-11-23 19:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/974) `Jess-Doit:test/xmem-committed-memory` → `main` · +182 −0 · 3 files · 1 commits · merged 2026-11-23 19:40 UTC ## Change Refs #870. Add the aligned committed CPU memory fixture requested in [the startup thread](https://git.gtahub.st/github/R0Y00--Xbox2Windows/issues/870). The fixture reserves three ordinary Windows pages at each guest alignment, 64 KiB and 2 MiB. It commits a non-page-multiple request, checks the exact commit and reserved tail with VirtualQuery, and verifies every committed byte before and after a cross-page write. It then checks that the allocation is released. Three refusal cases cover rounding overflow, unsupported protection, and a real Win32 commit beyond the reservation. Each preserves the two live pages and the reserved tail. The host failure reaches the caller as ERROR_INVALID_ADDRESS (487). ## Verification `02ebdbe` on Windows 10 22H2 (19045.6456), MSVC 19.44.35230 x64, Windows SDK 10.0.26100. Both presets passed 5/5 with no skips. Each alignment committed 8,192 bytes for a 4,101-byte request, checked 8,192 zero bytes and a 16-byte cross-page pattern, and released the reservation. ```powershell foreach ($preset in 'dev','release') { cmake --preset $preset cmake --build --preset $preset --target xmem_committed_memory_check memory_query_check xmem_shim_check ctest --preset $preset --no-tests=error -R '^(xmem_committed_memory|desktop_memory_query|xmem_shim_(exports|physical_pages|mapped_pages))$' --output-on-failure } python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py git diff HEAD^ HEAD --check ``` The source-built mutation controls failed when the fixture allowed the unsupported protection, replaced error 487 with 87, or skipped the write at byte 4,096. The documentation and diff checks passed. ## Evidence and follow-up Original MIT-licensed source in `tests/xmem_committed_memory_check.cpp`. The synthetic fixture checks CPU backing through the public Win32 APIs. Its protection allowlist is fixture policy. Reserve-only XMem calls and GPU registration remain with #888 and #874. See [aligned committed CPU memory](docs/experiments.md#aligned-committed-cpu-memory) for an isolated reproduction. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated the experiment documentation. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Codex).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:32:16 +00:00
github manually merged commit 02ebdbeaa2 into gh-pr/974/base 2026-11-26 22:32:19 +00:00
Author
Owner

@⁠legacy-code-archaeologist on GitHub · 2026-11-23 19:43 UTC · original

Independent run of 02ebdbe on Windows 11 (Windows 10 was the only OS so far): Windows 11 Pro 26100, Intel Core i7-6820HQ, MSVC 19.52, dev preset. The head merges cleanly with main at 23d2e93 (git merge-tree).

ctest --preset dev --no-tests=error -R '^xmem_committed_memory$' -V

The fixture passes with the same values at both alignments:

alignment=65536 requested=4101 committed=8192 zero_fill=8192 cross_page=16 released=1
refused overflow=534 protection=87 host_error=487 with existing pages unchanged
alignment=2097152 requested=4101 committed=8192 zero_fill=8192 cross_page=16 released=1
refused overflow=534 protection=87 host_error=487 with existing pages unchanged

The wider selection ^(xmem_|era_heap|desktop_memory_query) passes 22/22, with no skips. I did not run the release preset here.

AI-assisted (Claude Code).

**@⁠legacy-code-archaeologist** on GitHub · 2026-11-23 19:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/974#issuecomment-7112016397) Independent run of `02ebdbe` on Windows 11 (Windows 10 was the only OS so far): Windows 11 Pro 26100, Intel Core i7-6820HQ, MSVC 19.52, `dev` preset. The head merges cleanly with `main` at `23d2e93` (`git merge-tree`). ```powershell ctest --preset dev --no-tests=error -R '^xmem_committed_memory$' -V ``` The fixture passes with the same values at both alignments: ```text alignment=65536 requested=4101 committed=8192 zero_fill=8192 cross_page=16 released=1 refused overflow=534 protection=87 host_error=487 with existing pages unchanged alignment=2097152 requested=4101 committed=8192 zero_fill=8192 cross_page=16 released=1 refused overflow=534 protection=87 host_error=487 with existing pages unchanged ``` The wider selection `^(xmem_|era_heap|desktop_memory_query)` passes 22/22, with no skips. I did not run the `release` preset here. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No description provided.