runtime: reserve startup address space through XMemVirtualAlloc #888
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!888
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-888"
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?
@descent81 on GitHub · 2026-11-23 16:07 UTC · original
descent81:runtime/xmem-startup-reservation→main· +139 −4 · 8 files · 1 commits · draftRefs #870 and #874. The export table is shared with #880. This is a draft for comparison while that work and the current startup integration settle.
The startup investigation in #874 identified two reserve-only call shapes immediately after graphics virtual-memory configuration. This adds a named
XMemVirtualAllocexport for those shapes. The desktop implementation accepts a null base, a 16 or 24 GiB size, and the two reported attribute/protection pairs. It reserves uncommitted address space with Win32 and rejects other input combinations withERROR_INVALID_PARAMETER. This is a proposed desktop policy for those calls. The existing six export ordinals are preserved.Verification
Windows x64, MSVC 19.50, base
7198727, tested atb29089c. The source-built EXE imports the new function by name and runs under both the Windows loader andpe_map. It checks the exact size, alignment and state of both live reservations at each size. Unsupported requests must leave both regions intact. The test releases both ranges and confirms it can reserve a released address again. The missing-provider control stops at IAT binding before entry.Run for both
devandrelease(replace the preset in both commands):7 passed in Debug and 7 passed in Release, zero skips. The fixture uses only source-built inputs. Later commit and physical-page mapping are outside this reserve-only profile. No title entry was exercised.
AI-assisted.
github-bot referenced this pull request2026-11-27 01:51:59 +00:00
@R0Y00 on GitHub · 2026-11-23 17:50 UTC · original
I resolved the conflicts with the current grant and Tools Memory work locally. The reservation now uses an uncommitted PAGE_NOACCESS placeholder. On Windows x64 Release both loaders passed splitting a 64 KiB prefix from each reservation size, replacing it with a section view, writing and reading a word, restoring and coalescing the placeholder, and releasing it. The existing ordinals remain 1–9.
#934 adds the shared backing implementation. I will keep this draft separate and verify the two branches together using the real XMem map/unmap path, including remapping a live page and then releasing the grant. Please share any overlapping change here so we can keep a single reservation patch.
@R0Y00 on GitHub · 2026-11-23 18:05 UTC · original
The source-built integration can now map a 64 KiB page directly inside each untouched 16/24 GiB reservation. The shared backend splits the target page, preserves the written word through remapping, and coalesces the range before Win32 release. Keep the compatibility test in this PR, using the actual XMem map/unmap exports from #934. Keep a control for an ordinary reserved range and verify the whole range is reusable at the same address after release.
The prototype records reservation intervals for automatic splitting. Please define how a record stops authorizing splitting after the caller releases the range through Win32. Add a control that releases an XMem reservation, creates an unrelated range over the same address, and verifies that the old record cannot change the new range. If the shim cannot establish ownership after external release, document and scope the supported split or release path before merging. The two currently tested reserve configurations stay the scope of this PR.
@tedin7 on GitHub · 2026-11-27 09:37 UTC · original
This PR now conflicts with
main. Conflicting files:docs/experiments.mdsrc/xmem_shim.deftests/xmem_shim_check.cppCould you merge
maininto your branch (a merge commit, no force push needed) and resolve these? Thank you.AI-assisted; commands listed were executed locally. (
git merge-tree origin/main <head>)@Leyukaka on GitHub · 2026-12-01 16:20 UTC · original
This looks superseded by
main: #945 (merged asb3de0f4a0) reserves the XMem address space as mappable placeholders, #934 shares physical page backing across views, and #1098 commits startup blocks throughXMemVirtualAlloc. The maintainer's comments here asked for split, remap, coalescing and reuse after a Win32 release; if one of those is still missing on currentmain, it would fit a focused PR. Otherwise this one can probably be closed. Happy to be corrected if I missed something.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.