fix(bs2): preserve unsigned local DVD callback contract #1037

Merged
coah80 merged 1 commits from agent/bittle/bs2-callback-review into main 2026-10-03 04:05:57 +00:00
coah80 commented 2026-10-03 04:05:37 +00:00 (Migrated from github.com)

Callback contract

Use u32 for the DVD interrupt-status callback, matching DVDLowCallback, and remove five incompatible-function-pointer casts. Make the callback local, matching its original STB_LOCAL binding and translation-unit-only references.

Independent parent verification

  • Unsigned-only checkpoint is whole-object byte-identical; final static change alters only callback binding
  • All allocated bytes, section extents/alignments and 1461 relocation identities remain unchanged; every other symbol record preserved
  • Parent checked all ten original HA/LO registration references against raw DOL, resolving to callback0x8137BA1C
  • All 25 prior exact functions retain zero instruction differences; callback remains 2/2 instructions
  • Entire 1027-unit report unchanged; data stays155504/158528 and code5112/16980
  • Parent host type test rejects the old direct assignment to DVDLowCallback and accepts the corrected type; 200007 callback words preserved under UBSan
  • This is a type-check counterexample, not a claim that GCC UBSan detects the original incompatible indirect call
  • Pool91/91; literal advisory checks97 arguments in28 functions and explicitly skips unequal-sized BS2Tick
  • Full43U all_source/report/progress/DOL and worktree/diff checks pass

No percentage gain, new volatility, Run/assembly, boot behavior, shared header, storage or linking-configuration changes. No live DVD/Wii execution claim.

Base: a791e598a1
Tested tree: 2bdb996b29
DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d

No merge performed or requested by this author.

Note

Fix BS2 DVD callback to use unsigned 32-bit parameter

  • Changes the callback completion parameter in BS2Mach.c from signed to unsigned 32-bit, matching the DVDLowCallback function-pointer type. The callback still assigns the value to LowReadResult.
  • Removes explicit casts at the five callback registration sites (disk-ID read, both request-error handlers, and both partition-open handlers); the callback is now passed directly.
  • Restores internal static linkage for the callback.
  • Adds BS2Mach-dvd-callback-contract-20261003.md documenting the mismatch and validation results.
  • Risk: signed-to-unsigned comparison on the callback value in LowReadResult consumers may behave differently for values above 0x7FFFFFFF.

Macroscope summarized 53c57f4.

## Callback contract Use u32 for the DVD interrupt-status callback, matching DVDLowCallback, and remove five incompatible-function-pointer casts. Make the callback local, matching its original STB_LOCAL binding and translation-unit-only references. ## Independent parent verification - Unsigned-only checkpoint is whole-object byte-identical; final static change alters only callback binding - All allocated bytes, section extents/alignments and 1461 relocation identities remain unchanged; every other symbol record preserved - Parent checked all ten original HA/LO registration references against raw DOL, resolving to callback0x8137BA1C - All 25 prior exact functions retain zero instruction differences; callback remains 2/2 instructions - Entire 1027-unit report unchanged; data stays155504/158528 and code5112/16980 - Parent host type test rejects the old direct assignment to DVDLowCallback and accepts the corrected type; 200007 callback words preserved under UBSan - This is a type-check counterexample, not a claim that GCC UBSan detects the original incompatible indirect call - Pool91/91; literal advisory checks97 arguments in28 functions and explicitly skips unequal-sized BS2Tick - Full43U all_source/report/progress/DOL and worktree/diff checks pass No percentage gain, new volatility, Run/assembly, boot behavior, shared header, storage or linking-configuration changes. No live DVD/Wii execution claim. Base: a791e598a154e105d9ca81087d8d5912e222636a Tested tree: 2bdb996b29345bdb871121e621a496def6dd1690 DOL SHA1: 26116613f624061ba99c8d1a299aaa6efa85670d No merge performed or requested by this author. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Fix `BS2` DVD callback to use unsigned 32-bit parameter > - Changes the callback completion parameter in [BS2Mach.c](https://github.com/coah80/wii-ipl/pull/1037/files#diff-2abf473529b49cca688ecd961c46eb8e1f0a6f20ca9aeecb1f6633e8282b185d) from signed to unsigned 32-bit, matching the `DVDLowCallback` function-pointer type. The callback still assigns the value to `LowReadResult`. > - Removes explicit casts at the five callback registration sites (disk-ID read, both request-error handlers, and both partition-open handlers); the callback is now passed directly. > - Restores internal static linkage for the callback. > - Adds [BS2Mach-dvd-callback-contract-20261003.md](https://github.com/coah80/wii-ipl/pull/1037/files#diff-dcaa033a80869445e421fa2452b99fc48abd6551a53db253584f6c89dc25d5ed) documenting the mismatch and validation results. > - Risk: signed-to-unsigned comparison on the callback value in `LowReadResult` consumers may behave differently for values above 0x7FFFFFFF. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 53c57f4.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 04:05:55 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.