Repository navigation
xmem: support the two 64 KiB VA reservation forms reached at startup - #6709
Stalkerino wants to merge 2 commits into
Conversation
Only handle the observed reserve-only access and protection pairs. Retain host reservation state, granularity and CPU protection. AI-assisted.
|
Independent native Windows x64 check of ecee287e, MSVC 19.38 and Windows SDK 10.0.26100. All 21 assertions passed in a focused synthetic test calling XMem through the runtime registry. Both 65,537-byte requests returned 64 KiB-aligned reservations rounded to 128 KiB. Windows reported AI-assisted. |
|
Windows x64/MSVC validation of the same two reserve-only forms: both reserve and release successfully, are 64-KiB aligned and remain MEM_RESERVE. AllocationProtect is retained as PAGE_READWRITE for the CPU-visible reservation and PAGE_NOACCESS for the CPU-inaccessible reservation. Local XMem integration suite passes 115 checks (includes additional allocation-failure tracing). A debugger-assisted startup attempt then reaches a separate reserve+commit request using 2-MiB page mode, attributes 0x183 and CPU/GPU read-write plus coherent graphics protection. This remains rejected by the current shim. This corroborates the separate committed-allocation limitation described in this PR. It does not establish gameplay or GPU aliasing support. No game bytes, disassembly or logs are attached. AI-assisted with Codex. |
SirKingg
left a comment
There was a problem hiding this comment.
Independent review of ecee287: no blocking issue found in the two explicitly supported reserve-only forms.
Windows 11 x64 build 26300, MSVC 19.44.35230 and Windows SDK 10.0.26100: built xmem_test with CMake/Ninja and ran ctest -R ^xmem$ --output-on-failure (1/1 test; 109 checks). An additional synthetic registry-based MSVC harness passed 48 checks, covering both attribute/protection pairs, sizes 1, 65536 and 65537, reservation state, alignment, rounding, host allocation protection, explicit unaligned addresses, occupied-address rejection, zero and overflow, unsupported commit/extra flags, high attribute bits and mismatched protections. All successful test reservations were released.
Scope: no game files or guest execution, GPU mapping, physical-page backing or Xbox hardware/API conformance tests. The public GDK sample supports the five-argument API shape, not the numeric semantics of the observed pairs. The 2 MiB/commit cases remain unsupported and were not claimed as supported here. AI-assisted review.
|
Independent check against the retail executable (Xbox 1.0.2.1 package, executable SHA-256 matching the published one),
So this PR moves the real executable past both reservations, and the next blocker is the 2 MiB reserve-and-commit form, as described above. The only unimplemented import called before it is The local main build needs #4313 to get this far: without it the guest's slot-0 TLS writes land in gta6rt's own block. #4313 conflicts with main in AI-assisted. |
|
Native Windows check of
I don't have the retail executable, so I haven't run the startup path past these calls. AI-assisted (Claude Code). No game files. |
|
Tested On The next request is the 2 MiB reserve+commit (1.15 GiB, attributes Windows 11 26200, AMD RX 9070 XT, MSVC 14.44, Windows SDK 10.0.26100, own Xbox 1.0.2.1 package (with AI-assisted (Claude Code). |
|
Tested on the retail engine Confirmed: the two reserve-only calls (attributes 0x21 / PAGE_READWRITE and 0x3 / 0x801, 24 GiB each) succeed with this PR. But the allowlist is too narrow for the next three calls, which stop the title at an int3 when NULL comes back:
|
|
Independent Windows x64 startup check on the Xbox 1.0.2.1 package. MSVC 19.51, CMake/Ninja RelWithDebInfo, RTX 5060 (driver 32.0.16.2124), Vulkan selected. Compared
The trace establishes the change in startup behavior. Identifying the later allocation requires additional instrumentation. AI-assisted. |
|
Tested with my own copy of the retail executable on Windows 11 (RTX 3060), with
Offsets and arguments only; no game data. AI-assisted (Claude Code). |
|
Tested ecee287 merged with main 1cc6e3c on Windows 11 / RTX 4080 SUPER (driver 617.14) against own copy of the retail exe: pass
PR tests: |
|
Tested
Outcomes only. No game files, trace contents or title addresses. AI-assisted (Claude Code). |
…eservation forms reached at startup Author: Stalkerino Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UkEUa9YfGQH4p9g1Guw9gq
…orts (physical pages, default allocators, XMemIsToolsMemAvailable) Author: NiiRoZz Conflicts with ItsNotRexed#6709 in xmem.cpp, xmem_test.cpp and docs/runtime_imports.md, resolved to this PR's side: it accepts every attribute word and reserves 64 KiB-page regions as placeholders, which replaces the two allow-listed reservation forms of 6709 and the tests that expected the other forms to be refused. Not built here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UkEUa9YfGQH4p9g1Guw9gq
|
Looks superseded by #6908, now on Checked against the retail executable: Linux under Proton Experimental (wine 11.0), RTX 3070 (driver 620.70.06), Ryzen 5 5600X; AI-assisted (Claude Code); outcomes only, no game data. |
The Xbox runtime reports scalar calls to
XMemVirtualAllocwith nonzero access attributes at startup. Leonida rejected all of them before trying to reserve host address space. Implement the two observed reserve-only combinations with 64 KiB guest pages. The normal rounding and host allocation path supplies the reservation. The CPU-visible protection remains read/write or no-access respectively. No physical memory is committed and no GPU mapping is promised by a reservation.This is separate from #4531, which handles 2/4 MiB page alignment and also rejects nonzero access attributes. Microsoft's public AdvancedESRAM TransientAllocator uses the same five-parameter API shape, with separate allocation, access, and CPU/graphics protection arguments. The Windows SDK defines the graphics protection bit used by the no-access reservation. GDK sample
Verification
MEM_RESERVE,AllocationProtect, release and refusal of unimplemented commit forms.Coordination claim. AI-assisted.