runtime: implement physical-page allocation and release contract #901
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!901
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/901/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@stan495 on GitHub · 2026-11-23 16:30 UTC · original
stan495:codex/xmem-physical-pages→main· +235 −2 · 4 files · 1 commits · closed without mergingRefs #870. Fixes #880.
Summary
Implements the physical-page allocation, release and mapping contract for the desktop
xmem.dllruntime shim:XMemAllocatePhysicalPages: Allocates physical page descriptors (PFN tokens) at 64 KiB page granularity with a 4-bit shift, supporting console memory attributes (0x180,0x280,0x380).XMemFreePhysicalPages: Validates page ownership and releases allocated PFNs; rejects unowned or double-freed pages withERROR_INVALID_PARAMETER.XMemMapPhysicalPages&XMemMapPhysicalPagesScatter: Maps physical pages to reserved virtual memory addresses (MEM_COMMIT) or decommits whennullptris passed.XMemVirtualAlloc: Serves 64 KiB aligned virtual reservations.XMemTransferMemory: Provides physical/virtual memory buffer transfers.XMemIsToolsMemAvailable: ReturnsFALSEfor the desktop retail runtime.Evidence & Tests
Added the
xmem_shim_physical_pagessynthetic fixture scenario, covering:ERROR_INVALID_PARAMETER;Command & Result (dev preset):
All 9 tests passed. Pure-Python self-tests (
tests/docs_links_check.pyandtests/bidi_controls_check.py) passed cleanly.Startup Boundary Impact
In local startup mapping probes with
pe_map_image, import binding successfully advanced from 166 to 217 bound imports, resolvingxmem.dllin full and reaching the next startup boundary atd3d12_xs.dll!D3D12ConfigureVirtualMemoryX(#874).@R0Y00 on GitHub · 2026-11-23 16:33 UTC · original
I reproduced 5/5 of the focused Release tests at
c675ae1, then ran an independent Windows x64 control using only this PR's build and Win32 reservations. Three cases need revision before the mapping portion is ready:0x5ainto the first, and read the second. The second returns0x00. The currentMEM_COMMITmaps private storage at each address and ignores the page token. Please demonstrate shared backing and persistence through unmap/remap.#892 covers the allocation/release slice already. Please coordinate on that interface before changing the same exports, and keep mapping/scatter/transfer as follow-ups with their own readback checks. Thanks for getting a buildable candidate together.
@stan495 on GitHub · 2026-11-23 16:39 UTC · original
Closing in favor of #892 for the base physical-page allocation and release slice. I'll coordinate on the mapping follow-up with proper shared backing once #892 lands, and focus on #874 in the meantime. Thanks for the detailed review!
Pull request closed