runtime: inventory audio imports and add an ApuAlloc caller fixture #940

Merged
rasptum merged 2 commits from upstream-pr/947 into main 2026-11-23 18:49:38 +00:00
rasptum commented 2026-11-23 18:14:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T18:14:35Z.


Refs #870. This covers the audio slice from the 17:39Z note: an inventory of the unresolved audio-side imports, plus one source-built caller. It adds no production chad/xapu/acphal binding.

Inventory (docs/experiments.md, "Audio-side import inventory")

There are 19 unresolved imports: chad.dll has 5 XDsp*, xapu.dll has 5 XApu*, and acphal.dll has 3 AcpHal* and 6 Apu*.

  • Signature and desktop replacement: none.
  • Partial call shape: ApuAlloc and ApuFree. The source is MIT call sites in microsoft/DirectXTK12 at f3555e3 (SoundEffect.cpp, WaveBankReader.cpp, SoundStreamInstance.cpp). These establish an HRESULT return, a void** output, a second pointer-sized argument that every call site passes as nullptr (type not public), a UINT32 size, an alignment constant (value and width not public), and ApuFree(void*) with a discarded result.
  • Needs evidence: the other 17 stay explicitly unresolved. Microsoft's reference pages for them are behind the NDA program. Microsoft's MIT GDK Learn index at f8c3438 confirms that the XDsp*/XApu* functions are documented APIs, but it gives no signatures. ApuCreateHeap appears only in a DirectXTK12 diagnostic. No desktop counterpart is known for the stream, command-queue or SHAPE-context interfaces.

Caller

  • tests/cpu/apu_alloc_caller.asm imports ApuAlloc/ApuFree from acphal.dll by name.
  • tests/cpu/apu_alloc_provider.cpp is a test-only recording provider with a 64 KiB arena. Its policy (arena size, E_OUTOFMEMORY, output untouched on failure, release returns the space) is labelled proposed desktop policy.
  • Observable result: a 4 KiB block at 2 KiB alignment is returned, written and read back.
  • Refusal: a 128 KiB request returns E_OUTOFMEMORY and leaves the sentinel output untouched.
  • A 64 KiB request is refused while the first block is live and accepted after ApuFree. The caller checks its own provider counts and exits 0x8A0.
  • Native vs mapped: both exit 0x8A0 (Windows loader with and without a live worker, and pe_map). The mapped run records sizes [0x1000, 0x20000, 0x10000, 0x10000], alignment 0x800 and results [S_OK, E_OUTOFMEMORY, E_OUTOFMEMORY, S_OK].
  • Controls:
    • A lenient provider (APU_TEST_LENIENT) makes the caller stop at the refusal step (0xF02) under both loaders.
    • Withholding either import stops pe_map before entry (unresolved import acphal.dll!ApuAlloc / !ApuFree) with no recorded calls.

Not established: the console error codes, the meaning of the second argument, the alignment width, the heap size, and any ordering relative to ApuCreateHeap.

Tested

Commit f14e3f6 (rebased on 1c13def). Windows 10 Pro 10.0.19045.6466, MSVC 19.44 x64 (VS 2022 Build Tools), CMake/Ninja. I used INTAKE_PYTHON from a requirements-dev.txt venv and built the fixture targets in each preset:

cmake --build --preset dev --target pe_map cpu_exe_io cpu_apu_alloc_provider cpu_apu_alloc_provider_lenient cpu_apu_alloc_caller
ctest --preset dev --no-tests=error -R '^cpu_native_apu_alloc_caller$' -V
cmake --build --preset release --target pe_map cpu_exe_io cpu_apu_alloc_provider cpu_apu_alloc_provider_lenient cpu_apu_alloc_caller
ctest --preset release --no-tests=error -R '^cpu_native_apu_alloc_caller$' -V
Check Result
ctest --preset dev -R '^cpu_native_apu_alloc_caller$' 1/1 passed
ctest --preset release -R '^cpu_native_apu_alloc_caller$' 1/1 passed
tests/docs_links_check.py passed
tests/bidi_controls_check.py passed
tests/hardware_reports_check.py passed

No capability skips. The full suite was not run, because this change only adds new targets and one test.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6565849050 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/947). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-23T18:14:35Z. --- Refs #870. This covers the audio slice from the 17:39Z note: an inventory of the unresolved audio-side imports, plus one source-built caller. It adds no production `chad`/`xapu`/`acphal` binding. ## Inventory (`docs/experiments.md`, "Audio-side import inventory") There are 19 unresolved imports: `chad.dll` has 5 `XDsp*`, `xapu.dll` has 5 `XApu*`, and `acphal.dll` has 3 `AcpHal*` and 6 `Apu*`. - **Signature and desktop replacement:** none. - **Partial call shape:** `ApuAlloc` and `ApuFree`. The source is MIT call sites in [microsoft/DirectXTK12 at `f3555e3`](https://github.com/microsoft/DirectXTK12/tree/f3555e3014a53c81a6202b786dc4d6509b95a936) (`SoundEffect.cpp`, `WaveBankReader.cpp`, `SoundStreamInstance.cpp`). These establish an `HRESULT` return, a `void**` output, a second pointer-sized argument that every call site passes as `nullptr` (type not public), a `UINT32` size, an alignment constant (value and width not public), and `ApuFree(void*)` with a discarded result. - **Needs evidence:** the other 17 stay explicitly unresolved. Microsoft's reference pages for them are behind the NDA program. Microsoft's MIT [GDK Learn index at `f8c3438`](https://github.com/microsoft/XBOX-GDK-dotnet/blob/f8c3438aa366fbbb662d8a5e724021a9d0b65f5d/eng/gdk-learn-index.json) confirms that the `XDsp*`/`XApu*` functions are documented APIs, but it gives no signatures. `ApuCreateHeap` appears only in a DirectXTK12 diagnostic. No desktop counterpart is known for the stream, command-queue or SHAPE-context interfaces. ## Caller - `tests/cpu/apu_alloc_caller.asm` imports `ApuAlloc`/`ApuFree` from `acphal.dll` by name. - `tests/cpu/apu_alloc_provider.cpp` is a test-only recording provider with a 64 KiB arena. Its policy (arena size, `E_OUTOFMEMORY`, output untouched on failure, release returns the space) is labelled proposed desktop policy. - **Observable result:** a 4 KiB block at 2 KiB alignment is returned, written and read back. - **Refusal:** a 128 KiB request returns `E_OUTOFMEMORY` and leaves the sentinel output untouched. - A 64 KiB request is refused while the first block is live and accepted after `ApuFree`. The caller checks its own provider counts and exits `0x8A0`. - **Native vs mapped:** both exit `0x8A0` (Windows loader with and without a live worker, and `pe_map`). The mapped run records sizes `[0x1000, 0x20000, 0x10000, 0x10000]`, alignment `0x800` and results `[S_OK, E_OUTOFMEMORY, E_OUTOFMEMORY, S_OK]`. - **Controls:** - A lenient provider (`APU_TEST_LENIENT`) makes the caller stop at the refusal step (`0xF02`) under both loaders. - Withholding either import stops `pe_map` before entry (`unresolved import acphal.dll!ApuAlloc` / `!ApuFree`) with no recorded calls. Not established: the console error codes, the meaning of the second argument, the alignment width, the heap size, and any ordering relative to `ApuCreateHeap`. ## Tested Commit `f14e3f6` (rebased on `1c13def`). Windows 10 Pro 10.0.19045.6466, MSVC 19.44 x64 (VS 2022 Build Tools), CMake/Ninja. I used `INTAKE_PYTHON` from a `requirements-dev.txt` venv and built the fixture targets in each preset: ```powershell cmake --build --preset dev --target pe_map cpu_exe_io cpu_apu_alloc_provider cpu_apu_alloc_provider_lenient cpu_apu_alloc_caller ctest --preset dev --no-tests=error -R '^cpu_native_apu_alloc_caller$' -V cmake --build --preset release --target pe_map cpu_exe_io cpu_apu_alloc_provider cpu_apu_alloc_provider_lenient cpu_apu_alloc_caller ctest --preset release --no-tests=error -R '^cpu_native_apu_alloc_caller$' -V ``` | Check | Result | |---|---| | `ctest --preset dev -R '^cpu_native_apu_alloc_caller$'` | 1/1 passed | | `ctest --preset release -R '^cpu_native_apu_alloc_caller$'` | 1/1 passed | | `tests/docs_links_check.py` | passed | | `tests/bidi_controls_check.py` | passed | | `tests/hardware_reports_check.py` | passed | No capability skips. The full suite was not run, because this change only adds new targets and one test. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:45:32 +00:00
R0Y00 commented 2026-11-24 06:49:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T18:33:11Z.


I resolved the CMake and experiment-notes conflicts with #935. The Windows Release run passed both cpu_native_apu_alloc_caller and cpu_native_transfer_mem. The APU fixture catches the lenient provider under both loaders, and withholding either export leaves the trace empty before entry. I also checked the pinned DirectXTK12 call sites. They support the partial call shape documented here. The test-provider policies and the other audio interfaces remain open.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7110324663 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/947#issuecomment-7110324663). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T18:33:11Z. --- I resolved the CMake and experiment-notes conflicts with #935. The Windows Release run passed both cpu_native_apu_alloc_caller and cpu_native_transfer_mem. The APU fixture catches the lenient provider under both loaders, and withholding either export leaves the trace empty before entry. I also checked the pinned DirectXTK12 call sites. They support the partial call shape documented here. The test-provider policies and the other audio interfaces remain open.
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!940
No description provided.