HLE xmem: support MEM_COMMIT inside 64 KiB placeholder reservations #2277
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2277
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2277"
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?
@Sidlik900 on GitHub · 2026-11-25 09:29 UTC · original
Sidlik900:xmem/placeholder-commit→main· +388 −19 · 1 files · 1 commits · openClaimed in #1633.
Summary
MEM_COMMITinsidePAGES_64Kplaceholder shortcut inXMemVirtualAlloc(crates/victory-hle/src/modules/xmem.rs), which was also surfaced as a failing host case during diagnosis in #2025 (Windows 11 returnsERROR_INVALID_ADDRESSand other builds/Wine may returnERROR_INVALID_PARAMETERwhen committing directly into aMEM_RESERVE_PLACEHOLDER).VirtualAlloc2rejects a non-nullMEM_COMMIT(withoutMEM_RESERVE) withis_placeholder_commit_error,commit_in_placeholder:[base, base + size)withquery_region(VirtualQueryEx) to confirm the entire range covers non-freeMEM_PRIVATEmemory, failing before mutating earlier placeholders if any chunk is free, out of bounds, or mapped;PAGE-alignedMEM_RESERVEplaceholders splits strictly smaller sub-ranges on 64 KiBPAGEboundaries withVirtualFree(..., MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER), replaces the isolated placeholder withMEM_RESERVE | MEM_REPLACE_PLACEHOLDER | MEM_WRITE_WATCH(PAGE_NOACCESS, falling back withoutMEM_WRITE_WATCHif unsupported), and commits[cursor, chunk_end)withkindandprotect;SetLastErroron error before callingcommit_refused.committing_all_or_part_of_a_64k_placeholder_succeeds(andrelease_rangehelper) covering partial 64 KiB placeholder commits,GetWriteWatchverification on replaced ranges, sibling placeholderXMemMapPhysicalPagescompatibility, 4 KiB / unaligned-address sub-commits, commits straddling private and placeholder regions, boundary and mapped-view refusal without corrupting untouched placeholders, and whole-placeholder commits.Verification
cargo xtask policy(asset policy: 182 files ok)cargo test -p victory-hle --locked(144unit tests including all11modules::xmem::tests::*tests +fidelityfx+no_dll_plantingpassed; one pre-existing timing race inmodules::dstorage::tests::a_page_list_filled_after_its_request_startsfailed on an initial run and passed cleanly on rerun)cargo test -p victory-hle --all-features --locked(144unit tests +fidelityfx+no_dll_plantingpassed)cargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningsrustfmt --edition 2024 --check crates/victory-hle/src/modules/xmem.rs(zero diffs on added/edited lines; 4 pre-existing untouched formatting diffs inxmem.rsleft intact)AI-assisted (Antigravity); synthetic tests only, no game data.
@Marvisak on GitHub · 2026-11-25 13:32 UTC · original · edited 2026-11-25 22:21 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflict incrates/victory-hle/src/modules/xmem.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: evidence the title commits into a placeholder reservation, keeping the title's later
MEM_RELEASEof the whole reservation working, and a CI run.Generated by Claude Code
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.