docs(audio_hal_exe_calls): fill the argument gaps the page left open (AUDIO-IMPORT-CALL-SHAPES) #1167

Merged
robot00f merged 1 commit from upstream-pr/1167 into main 2026-11-29 14:41:48 +00:00
robot00f commented 2026-11-24 19:30:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-24T19:30:44Z.


Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141414296 (ID AUDIO-IMPORT-CALL-SHAPES; earlier Spanish wording: #issuecomment-7140238118)

What and why

docs/audio_hal_exe_calls.md already records every audio import's site count, constants and return use, but six rows stop short: two say no argument was read, one says the arguments were not read further, and three describe a tail jump or a wrapper without saying what they forward. Those are the parts a shim needs, so this fills them from the same static reads (no run):

  • XApuConnect: three arguments, the addresses of three .data globals (0x149B69890, 0x149B698A8, 0x149B68960), and the result is tested as non-negative.
  • XApuGetResultCount: the queue handle global and a second argument 0; the count is tested for zero.
  • XApuDequeueResult: the same handle and a 16-byte stack out buffer; the record is read at +0x20/+0x24 when the result is not negative.
  • XDspSubmitCommand and XDspActivate: both are wrappers that swap two incoming registers before the call (rcx/rdx and r8/r9), so the published order is the reverse of the wrapper's.
  • ApuFree: the site is a whole function that is a single jmp to the thunk, so it forwards its arguments unchanged and contributes no arity of its own.

Docs only, six table rows, no other text touched.

Tested

  • Static disassembly of each site and its wrapper (nothing executed).
  • check_no_game_data.py -> exit 0; tests/test_docs_links.py and tests/test_docs_table_rows.py -> OK.

GPUs tested: n/a

AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md. (No translator change.)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5478920779 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1167). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-24T19:30:44Z. --- Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141414296 (ID `AUDIO-IMPORT-CALL-SHAPES`; earlier Spanish wording: #issuecomment-7140238118) ### What and why docs/audio_hal_exe_calls.md already records every audio import's site count, constants and return use, but six rows stop short: two say no argument was read, one says the arguments were not read further, and three describe a tail jump or a wrapper without saying what they forward. Those are the parts a shim needs, so this fills them from the same static reads (no run): - XApuConnect: three arguments, the addresses of three .data globals (0x149B69890, 0x149B698A8, 0x149B68960), and the result is tested as non-negative. - XApuGetResultCount: the queue handle global and a second argument 0; the count is tested for zero. - XApuDequeueResult: the same handle and a 16-byte stack out buffer; the record is read at +0x20/+0x24 when the result is not negative. - XDspSubmitCommand and XDspActivate: both are wrappers that swap two incoming registers before the call (rcx/rdx and r8/r9), so the published order is the reverse of the wrapper's. - ApuFree: the `site` is a whole function that is a single jmp to the thunk, so it forwards its arguments unchanged and contributes no arity of its own. Docs only, six table rows, no other text touched. ### Tested - Static disassembly of each site and its wrapper (nothing executed). - check_no_game_data.py -> exit 0; tests/test_docs_links.py and tests/test_docs_table_rows.py -> OK. GPUs tested: n/a AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash) ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [ ] A new translator rule is in the contract table of docs/design.md. (No translator change.)
abnalstlll-byte commented 2026-11-24 19:32:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:32:26Z.

Review: APPROVED


Reviewed and verified. Documents exact call signatures, register passing conventions, and return value checks for XApuConnect, XApuGetResultCount, XApuDequeueResult, XDspSubmitCommand, XDspActivate, and ApuFree in docs/audio_hal_exe_calls.md. Clean-room compliant.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6045983723 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1167#pullrequestreview-6045983723). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T19:32:26Z. **Review:** APPROVED --- Reviewed and verified. Documents exact call signatures, register passing conventions, and return value checks for `XApuConnect`, `XApuGetResultCount`, `XApuDequeueResult`, `XDspSubmitCommand`, `XDspActivate`, and `ApuFree` in `docs/audio_hal_exe_calls.md`. Clean-room compliant.
Deedlyy commented 2026-11-24 20:11:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:11:08Z.


Recommendation: [MERGE]

Reasoning: Docs: fills six rows in audio_hal_exe_calls.md with the arguments that were left unread (XApuConnect etc.) from the same static reads. Documentation only. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143160289 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1167#issuecomment-7143160289). Originally posted by [Deedlyy](https://github.com/Deedlyy) on 2026-11-24T20:11:08Z. --- **Recommendation:** [MERGE] **Reasoning:** Docs: fills six rows in `audio_hal_exe_calls.md` with the arguments that were left unread (XApuConnect etc.) from the same static reads. Documentation only. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
zmasi commented 2026-11-28 23:48:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:48:05Z.


Native Windows 11 Verification & Shim Cross-Check (16ac8f3041)

Diff-audited docs/audio_hal_exe_calls.md (+6/-6) and verified merged onto origin/main (a9e247cd69) on Windows 11 (10.0.26200, Python 3.12.10 with -I).

Documentation & Policy Suites

  • All tests/test_docs_*.py suites (0 PR-introduced issues across all 13 doc checks), tests/test_text_write_line_endings.py (3/3), and scripts/check_no_game_data.py pass (rc=0).

Two Discrepancies Against Landed runtime/shims/xapu_*.cpp Measurements

Cross-checking the new rows against runtime/shims/xapu_queue.cpp and runtime/shims/xapu_chad.cpp on origin/main surfaced two mismatches worth reconciling:

  1. XApuDequeueResult stack buffer size (docs/audio_hal_exe_calls.md:45):
    • The new row says "a 16-byte stack buffer as the second argument; a negative result jumps out, otherwise the record is read from buffer +0x20/+0x24". Reading +0x20/+0x24 would be out of bounds of a 16-byte buffer: +0x20/+0x24 are the caller's stack-frame offsets ([rsp+0x20] / [rsp+0x24]), i.e. +0x00/+0x04 of a 0x50-byte stack local starting at rsp+0x20 (as recorded in runtime/shims/xapu_queue.cpp:16-18, where the caller zeroes a 0x50-byte local and reads +0, +4, and +0x34).
  2. XDspSubmitCommand arity (docs/audio_hal_exe_calls.md:51):
    • The new row calls the wrapper "a two-argument wrapper that swaps the incoming registers (rcx <- rdx, rdx <- old rcx)", whereas runtime/shims/xapu_chad.cpp:12,73 records XDspSubmitCommand(stream, cmd*, id*) as a three-argument call (r8 passes uint32_t* id through unchanged while rcx/rdx swap).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7247672226 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1167#issuecomment-7247672226). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T23:48:05Z. --- ### Native Windows 11 Verification & Shim Cross-Check (`16ac8f3041`) Diff-audited `docs/audio_hal_exe_calls.md` (`+6/-6`) and verified merged onto `origin/main` (`a9e247cd69`) on Windows 11 (`10.0.26200`, Python `3.12.10` with `-I`). #### Documentation & Policy Suites - All `tests/test_docs_*.py` suites (`0` PR-introduced issues across all 13 doc checks), `tests/test_text_write_line_endings.py` (`3/3`), and `scripts/check_no_game_data.py` pass (`rc=0`). #### Two Discrepancies Against Landed `runtime/shims/xapu_*.cpp` Measurements Cross-checking the new rows against `runtime/shims/xapu_queue.cpp` and `runtime/shims/xapu_chad.cpp` on `origin/main` surfaced two mismatches worth reconciling: 1. **`XApuDequeueResult` stack buffer size (`docs/audio_hal_exe_calls.md:45`)**: - The new row says *"a 16-byte stack buffer as the second argument; a negative result jumps out, otherwise the record is read from buffer `+0x20`/`+0x24`"*. Reading `+0x20`/`+0x24` would be out of bounds of a 16-byte buffer: `+0x20`/`+0x24` are the caller's stack-frame offsets (`[rsp+0x20]` / `[rsp+0x24]`), i.e. `+0x00`/`+0x04` of a **`0x50`-byte stack local** starting at `rsp+0x20` (as recorded in `runtime/shims/xapu_queue.cpp:16-18`, where the caller zeroes a `0x50`-byte local and reads `+0`, `+4`, and `+0x34`). 2. **`XDspSubmitCommand` arity (`docs/audio_hal_exe_calls.md:51`)**: - The new row calls the wrapper *"a two-argument wrapper that swaps the incoming registers (`rcx` <- `rdx`, `rdx` <- old `rcx`)"*, whereas `runtime/shims/xapu_chad.cpp:12,73` records `XDspSubmitCommand(stream, cmd*, id*)` as a **three-argument** call (`r8` passes `uint32_t* id` through unchanged while `rcx`/`rdx` swap). AI-assisted.
MoonEyes commented 2026-11-29 14:41:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:41:50Z.


Merged at head 16ac8f3. Docs-only, reviewed on this head by zmasi (PASS); no test applies. AI-assisted: yes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257505030 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1167#issuecomment-7257505030). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T14:41:50Z. --- Merged at head 16ac8f3. Docs-only, reviewed on this head by zmasi (PASS); no test applies. AI-assisted: yes.
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
ProjectLeonida/mandy!1167
No description provided.