kernelx: delegate current-process VirtualAllocEx/FreeEx/ProtectEx #1564

Open
github-bot wants to merge 1 commit from github-bot/gh-1564 into main AGit
Owner

@⁠hajduzsolt on GitHub · 2026-11-24 17:43 UTC · original
hajduzsolt:kernelx/virtual-alloc-ex-current-process → main · +51 −6 · 1 files · 1 commits · open

Delegates VirtualAllocEx, VirtualFreeEx, and VirtualProtectEx to XCL's VirtualAlloc, VirtualFree, and VirtualProtect when targeting GetCurrentProcess(), fixing console/placeholder/graphics flag stripping and missing placeholder cleanup. Part of #1489.

What is in it

  • crates/xcl/src/hle/kernelx.rs: forward current-process VirtualAllocEx, VirtualFreeEx, and VirtualProtectEx calls to VirtualAlloc, VirtualFree, and VirtualProtect so placeholders (placeholders::alloc / placeholders::free), UMA/sparse VRAM windows, coherent heaps, and GRAPHICS_RESERVATIONS are handled identically to non-Ex calls.
  • crates/xcl/src/hle/kernelx.rs: add unit test virtual_alloc_ex_and_protect_ex_current_process_delegation verifying graphics allocation tracking and placeholder reservation/split through VirtualAllocEx and VirtualFreeEx.

Tested

  • Hardware & toolchain: AMD Radeon RX 9070 XT (driver 32.0.32029.2010), AMD Ryzen 7 9800X3D, Windows 11 10.0.26300.9974, rustc 1.98.1 (48a229cea 2026-09-01), debug (cargo test).
  • cargo test -p xcl --lib hle::kernelx::tests -- --test-threads=2: 30 passed, 0 failed, 1 ignored.
  • cargo test --workspace -- --test-threads=2: 777 passed, 0 failed, 41 ignored (xcl --lib: 728 passed, 0 failed, 21 ignored; integration/e2e suites: 49 passed, 0 failed, 20 ignored).
  • SKIPPED runtime tests: SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows.

Regression run

main:

xcl-smoke v1
commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1594 (PresentX 1594)
presents per 2 s (last 3): 49 48 14
device removals: 0
crashes: 0
peak commit: 20195 MB

PR:

xcl-smoke v1
commit: 48e36e8155f17f2ee935422b3bd9e2180581e575
gpu: AMD Radeon RX 9070 XT
title: A newer retail game
seconds: 60
exit: 0x0
frames shown: 1679 (PresentX 1679)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14839 MB

Not tested

  • Cross-process (proc_ != GetCurrentProcess()) calls and NVIDIA / Intel Arc adapters.

AI use

  • Antigravity (Gemini 4 Hydrogen, high): implemented current-process VirtualAllocEx/VirtualFreeEx/VirtualProtectEx delegation, wrote the unit test, ran the test suite, and prepared commit and PR description.
**@⁠hajduzsolt** on GitHub · 2026-11-24 17:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1564) `hajduzsolt:kernelx/virtual-alloc-ex-current-process` → `main` · +51 −6 · 1 files · 1 commits · open Delegates VirtualAllocEx, VirtualFreeEx, and VirtualProtectEx to XCL's VirtualAlloc, VirtualFree, and VirtualProtect when targeting GetCurrentProcess(), fixing console/placeholder/graphics flag stripping and missing placeholder cleanup. Part of #1489. **What is in it** - crates/xcl/src/hle/kernelx.rs: forward current-process VirtualAllocEx, VirtualFreeEx, and VirtualProtectEx calls to VirtualAlloc, VirtualFree, and VirtualProtect so placeholders (placeholders::alloc / placeholders::free), UMA/sparse VRAM windows, coherent heaps, and GRAPHICS_RESERVATIONS are handled identically to non-Ex calls. - crates/xcl/src/hle/kernelx.rs: add unit test virtual_alloc_ex_and_protect_ex_current_process_delegation verifying graphics allocation tracking and placeholder reservation/split through VirtualAllocEx and VirtualFreeEx. **Tested** - Hardware & toolchain: AMD Radeon RX 9070 XT (driver 32.0.32029.2010), AMD Ryzen 7 9800X3D, Windows 11 10.0.26300.9974, rustc 1.98.1 (48a229cea 2026-09-01), debug (cargo test). - cargo test -p xcl --lib hle::kernelx::tests -- --test-threads=2: 30 passed, 0 failed, 1 ignored. - cargo test --workspace -- --test-threads=2: 777 passed, 0 failed, 41 ignored (xcl --lib: 728 passed, 0 failed, 21 ignored; integration/e2e suites: 49 passed, 0 failed, 20 ignored). - SKIPPED runtime tests: SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows. **Regression run** main: ``` xcl-smoke v1 commit: c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1594 (PresentX 1594) presents per 2 s (last 3): 49 48 14 device removals: 0 crashes: 0 peak commit: 20195 MB ``` PR: ``` xcl-smoke v1 commit: 48e36e8155f17f2ee935422b3bd9e2180581e575 gpu: AMD Radeon RX 9070 XT title: A newer retail game seconds: 60 exit: 0x0 frames shown: 1679 (PresentX 1679) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14839 MB ``` **Not tested** - Cross-process (proc_ != GetCurrentProcess()) calls and NVIDIA / Intel Arc adapters. **AI use** - Antigravity (Gemini 4 Hydrogen, high): implemented current-process VirtualAllocEx/VirtualFreeEx/VirtualProtectEx delegation, wrote the unit test, ran the test suite, and prepared commit and PR description.
VirtualAllocEx unconditionally forwarded to host mem::VirtualAllocEx, stripping console allocation flags and bypassing placeholders::alloc, UMA, sparse VRAM, coherent heaps, and GRAPHICS_RESERVATIONS. VirtualFreeEx only delegated sparse/UMA/graphics-release calls to VirtualFree, bypassing placeholders::free.

Delegate VirtualAllocEx, VirtualFreeEx, and VirtualProtectEx directly to VirtualAlloc, VirtualFree, and VirtualProtect when targeting GetCurrentProcess().

Part of #1489

Assisted-by: Antigravity (Gemini 4 Hydrogen, high)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:39 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 19:41 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 19:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/1564#issuecomment-7142451459) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1564/head:github-bot/gh-1564'
git switch 'github-bot/gh-1564'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1564'
git switch 'github-bot/gh-1564'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1564'
git switch 'github-bot/gh-1564'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1564'
git switch 'main'
git merge --squash 'github-bot/gh-1564'
git switch 'main'
git merge --ff-only 'github-bot/gh-1564'
git switch 'main'
git merge 'github-bot/gh-1564'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.