cpu: XApu command-queue caller and recording provider fixture #1064

Merged
rasptum merged 2 commits from upstream-pr/1071 into main 2026-11-24 00:34:55 +00:00
rasptum commented 2026-11-24 00:16:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-24T00:16:49Z.


Refs #870

Source-built caller and test-only recording provider for the xapu.dll command queue (XApuConnect, XApuEnqueueCommand, XApuGetResultCount, XApuDequeueResult, XApuDisconnect), in the #947/#1000 fixture layout. This is the XApu stage only. The chad.dll XDsp stream lifecycle is a separate, later PR. No production export, and no change to src/ or to the #1000 ACP slice.

Evidence and fixture policy

No public source gives these signatures. Microsoft's MIT GDK Learn index at f8c3438 names the functions and the types XApuConnectInputParameters, XApuConnectOutputParameters, XApuCommandId and XApuResult, but lists all of them under restricted. DirectXTK12 at f3555e3 has no XApu* reference. The symbols and signatures below are fixture policy until there is an independent reference, not the console contract:

Function Fixture convention
XApuConnect HRESULT (UINT64* client). New nonzero handle, never reused.
XApuEnqueueCommand HRESULT (UINT64 client, UINT64 id, UINT32 payload). Completes at once, result {id, payload + 0x1000, S_OK}.
XApuGetResultCount HRESULT (UINT64 client, UINT32* count)
XApuDequeueResult HRESULT (UINT64 client, {UINT64 id; UINT32 value; HRESULT status}*), FIFO
XApuDisconnect HRESULT (UINT64 client)

The refusal codes are fixture choices too: E_HANDLE for an unknown, zero or disconnected handle, and 0x80070103 for an empty queue. A failed call leaves its output untouched. No external provider source was read or used.

What the fixture checks

  • Observable result: connect, enqueue IDs 0x101, 0x102, 0x103, count 3, then dequeue them in that order with matching values, with the count falling 2, 1, 0. The provider records the IDs on enqueue and on dequeue, and the check compares both sequences.
  • Refusals: empty-queue dequeue, unknown-handle enqueue and dequeue, zero-handle count, second disconnect, and enqueue after disconnect. The caller checks that its outputs are unchanged. The provider reads each refused output without writing it, and the check confirms that it saw the caller's sentinel at all three refusals that have an output.
  • Controls:
    • A lenient-handle build stops the caller at the handle step with 0xF05.
    • A LIFO build stops it at the order step with 0xF03.
    • Without xapu.dll, the Windows loader refuses the process with 0xC0000135.
    • With the provider missing, or any one of the five imports withheld, pe_map stops before entry and the provider records no calls.
    • Mutation check (local, not committed): a provider that wrote the output on an empty-queue refusal failed the test.

Tested

Commit 658e6eb4, on upstream/main at d33845b9. Windows 10 Pro 10.0.19045, MSVC 19.44 x64, CMake/Ninja. Inputs are source-built only. The full dev and release builds and test runs below were on the same two commits based on 03029a27. After main moved, including the tools/pe_map.cpp change in #1058, I rebased (clean), rebuilt pe_map, cpu_exe_io and the four fixtures' targets in both presets, and reran the same four tests: 4/4 in each.

cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^cpu_native_(xapu_queue|apu_alloc_caller|apu_address|acphal_hal)$' -V
cmake --build --preset release
ctest --preset release --no-tests=error -R '^cpu_native_(xapu_queue|apu_alloc_caller|apu_address|acphal_hal)$' -V

Each preset passed 4/4 (xapu_queue plus the neighbouring audio tests). tests/docs_links_check.py and tests/bidi_controls_check.py passed.

native and mapped exit 0x8b0; FIFO IDs ['0x101', '0x102', '0x103']; 6 refusals; sentinels seen at refusal ['0xa9a9a9a9a9a9a9a9', '0xa9a9a9a9a9a9a9a9', '0xa9a9a9a9']
lenient provider: native and mapped exit 0xf05 at the handle step
LIFO provider: native and mapped exit 0xf03 at the order step
Windows loader without xapu.dll: 0xc0000135
before entry: unresolved import xapu.dll!XApuGetResultCount   (provider missing)
before entry: unresolved import xapu.dll!XApuConnect          (and each of the other four withheld)

Not established

The console signatures, the parameter and result layouts, the handle type, the error codes, whether commands complete asynchronously, and which commands the startup path submits. This is a fixture result, not a startup result.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6571640940 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1071). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-24T00:16:49Z. --- Refs #870 Source-built caller and test-only recording provider for the `xapu.dll` command queue (`XApuConnect`, `XApuEnqueueCommand`, `XApuGetResultCount`, `XApuDequeueResult`, `XApuDisconnect`), in the #947/#1000 fixture layout. This is the XApu stage only. The `chad.dll` XDsp stream lifecycle is a separate, later PR. No production export, and no change to `src/` or to the #1000 ACP slice. ## Evidence and fixture policy No public source gives these signatures. Microsoft's MIT [GDK Learn index at `f8c3438`](https://github.com/microsoft/XBOX-GDK-dotnet/blob/f8c3438aa366fbbb662d8a5e724021a9d0b65f5d/eng/gdk-learn-index.json) names the functions and the types `XApuConnectInputParameters`, `XApuConnectOutputParameters`, `XApuCommandId` and `XApuResult`, but lists all of them under `restricted`. [DirectXTK12 at `f3555e3`](https://github.com/microsoft/DirectXTK12/tree/f3555e3014a53c81a6202b786dc4d6509b95a936) has no `XApu*` reference. The symbols and signatures below are **fixture policy until there is an independent reference**, not the console contract: | Function | Fixture convention | |---|---| | `XApuConnect` | `HRESULT (UINT64* client)`. New nonzero handle, never reused. | | `XApuEnqueueCommand` | `HRESULT (UINT64 client, UINT64 id, UINT32 payload)`. Completes at once, result `{id, payload + 0x1000, S_OK}`. | | `XApuGetResultCount` | `HRESULT (UINT64 client, UINT32* count)` | | `XApuDequeueResult` | `HRESULT (UINT64 client, {UINT64 id; UINT32 value; HRESULT status}*)`, FIFO | | `XApuDisconnect` | `HRESULT (UINT64 client)` | The refusal codes are fixture choices too: `E_HANDLE` for an unknown, zero or disconnected handle, and `0x80070103` for an empty queue. A failed call leaves its output untouched. No external provider source was read or used. ## What the fixture checks - **Observable result:** connect, enqueue IDs `0x101`, `0x102`, `0x103`, count 3, then dequeue them in that order with matching values, with the count falling 2, 1, 0. The provider records the IDs on enqueue and on dequeue, and the check compares both sequences. - **Refusals:** empty-queue dequeue, unknown-handle enqueue and dequeue, zero-handle count, second disconnect, and enqueue after disconnect. The caller checks that its outputs are unchanged. The provider reads each refused output without writing it, and the check confirms that it saw the caller's sentinel at all three refusals that have an output. - **Controls:** - A lenient-handle build stops the caller at the handle step with `0xF05`. - A LIFO build stops it at the order step with `0xF03`. - Without `xapu.dll`, the Windows loader refuses the process with `0xC0000135`. - With the provider missing, or any one of the five imports withheld, `pe_map` stops before entry and the provider records no calls. - Mutation check (local, not committed): a provider that wrote the output on an empty-queue refusal failed the test. ## Tested Commit `658e6eb4`, on `upstream/main` at `d33845b9`. Windows 10 Pro 10.0.19045, MSVC 19.44 x64, CMake/Ninja. Inputs are source-built only. The full `dev` and `release` builds and test runs below were on the same two commits based on `03029a27`. After main moved, including the `tools/pe_map.cpp` change in #1058, I rebased (clean), rebuilt `pe_map`, `cpu_exe_io` and the four fixtures' targets in both presets, and reran the same four tests: 4/4 in each. ```powershell cmake --build --preset dev ctest --preset dev --no-tests=error -R '^cpu_native_(xapu_queue|apu_alloc_caller|apu_address|acphal_hal)$' -V cmake --build --preset release ctest --preset release --no-tests=error -R '^cpu_native_(xapu_queue|apu_alloc_caller|apu_address|acphal_hal)$' -V ``` Each preset passed 4/4 (`xapu_queue` plus the neighbouring audio tests). `tests/docs_links_check.py` and `tests/bidi_controls_check.py` passed. ```text native and mapped exit 0x8b0; FIFO IDs ['0x101', '0x102', '0x103']; 6 refusals; sentinels seen at refusal ['0xa9a9a9a9a9a9a9a9', '0xa9a9a9a9a9a9a9a9', '0xa9a9a9a9'] lenient provider: native and mapped exit 0xf05 at the handle step LIFO provider: native and mapped exit 0xf03 at the order step Windows loader without xapu.dll: 0xc0000135 before entry: unresolved import xapu.dll!XApuGetResultCount (provider missing) before entry: unresolved import xapu.dll!XApuConnect (and each of the other four withheld) ``` ## Not established The console signatures, the parameter and result layouts, the handle type, the error codes, whether commands complete asynchronously, and which commands the startup path submits. This is a fixture result, not a startup result. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:46:08 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1064
No description provided.