Match SD disk-info success return and restore its epilogue extent #481

Merged
coah80 merged 3 commits from agent/bittle/sd-disk-info-epilogue into main 2026-10-01 21:26:41 +00:00
coah80 commented 2026-10-01 21:24:31 +00:00 (Migrated from github.com)

Original-binary evidence

pfd_sddrv_get_disk_info begins at 0x815EAC64. Its recorded size 0x180 ends at 0x815EADE4, immediately after mtlr r0 at 0x815EADE0. The original DOL then contains:

  • 0x815EADE4: addi r1, r1, 0x20
  • 0x815EADE8: blr
  • 0x815EADEC: next function, pfd_sddrv_init_drv_tbl

Set the verified extent to 0x188, without moving any split or overlapping the next symbol. The source also needs an explicit return 0 on its successful path: the original emits li r3, 0 there, whereas returning the known-zero local result removed that instruction. Error returns remain unchanged.

Validation

Fresh baseline/report: main d613662c. Fetched again immediately before opening; unchanged. Published blobs match tested files.

  • pfd_sddrv_get_disk_info: 98/98 instructions, zero ctxdiff differences, objdiff 100%.
  • SD driver exact functions: 19/26 → 20/26; matched code 8,284 → 8,676 bytes. The unit remains NonMatching/unlinked because its other six functions/data still need work.
  • No previously exact function or matched data regressed across the full report. SD matched data stays 408/3,592; no claim that the whole unit's data is correct.
  • String pools identical: 46/46.
  • Full ninja all_source progress build/43U/report.json build/43U/ok passes. DOL SHA-1 26116613f624061ba99c8d1a299aaa6efa85670d.
  • Workflow guards 7/7, pool tests 8/8, and git diff --check pass.
  • Live report now counts 2,995,188 code bytes after including these eight original epilogue bytes, so the completion checker's fixed code total is updated from 2,995,180. No function/unit/data count changes.

One unit, one genuine source correction and its evidenced symbol extent. No assembly, padding objects or original binaries committed. Merge is left to Cole.

Note

Fix pfd_sddrv_get_disk_info success return and extend size to 0x188

  • Changes the success return of pfd_sddrv_get_disk_info in sd_drv.c to the literal success value 0 instead of the result variable. The error path still returns result when pfd_sddrv_get_total_sectors fails.
  • Updates the recorded size of pfd_sddrv_get_disk_info from 0x180 to 0x188 in symbols.txt, matching the restored epilogue extent.
  • Bumps the expected total code size in check_decomp_complete.py from 2,995,180 to 2,995,188.

Macroscope summarized 5b6a217.

## Original-binary evidence `pfd_sddrv_get_disk_info` begins at **0x815EAC64**. Its recorded size 0x180 ends at **0x815EADE4**, immediately after `mtlr r0` at 0x815EADE0. The original DOL then contains: - **0x815EADE4:** `addi r1, r1, 0x20` - **0x815EADE8:** `blr` - **0x815EADEC:** next function, `pfd_sddrv_init_drv_tbl` Set the verified extent to **0x188**, without moving any split or overlapping the next symbol. The source also needs an explicit `return 0` on its successful path: the original emits `li r3, 0` there, whereas returning the known-zero local `result` removed that instruction. Error returns remain unchanged. ## Validation Fresh baseline/report: main **d613662c**. Fetched again immediately before opening; unchanged. Published blobs match tested files. - `pfd_sddrv_get_disk_info`: **98/98 instructions, zero ctxdiff differences, objdiff 100%**. - SD driver exact functions: **19/26 → 20/26**; matched code **8,284 → 8,676 bytes**. The unit remains NonMatching/unlinked because its other six functions/data still need work. - **No previously exact function or matched data regressed across the full report.** SD matched data stays **408/3,592**; no claim that the whole unit's data is correct. - String pools identical: **46/46**. - Full `ninja all_source progress build/43U/report.json build/43U/ok` passes. DOL SHA-1 **26116613f624061ba99c8d1a299aaa6efa85670d**. - Workflow guards **7/7**, pool tests **8/8**, and `git diff --check` pass. - Live report now counts **2,995,188 code bytes** after including these eight original epilogue bytes, so the completion checker's fixed code total is updated from 2,995,180. No function/unit/data count changes. One unit, one genuine source correction and its evidenced symbol extent. No assembly, padding objects or original binaries committed. Merge is left to Cole. <!-- 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 `pfd_sddrv_get_disk_info` success return and extend size to 0x188 > - Changes the success return of `pfd_sddrv_get_disk_info` in [sd_drv.c](https://github.com/coah80/wii-ipl/pull/481/files#diff-cff6d99ae65b0a148b6ad31c34a72f78c4e3887de7fe48985cea8c41063e52e2) to the literal success value 0 instead of the `result` variable. The error path still returns `result` when `pfd_sddrv_get_total_sectors` fails. > - Updates the recorded size of `pfd_sddrv_get_disk_info` from 0x180 to 0x188 in [symbols.txt](https://github.com/coah80/wii-ipl/pull/481/files#diff-92f49dd4754762deffc0a2c26a42d508945e86a4db65a437b06cd7a740fab114), matching the restored epilogue extent. > - Bumps the expected total code size in [check_decomp_complete.py](https://github.com/coah80/wii-ipl/pull/481/files#diff-40b9b0f9d80df58a34763b21558dfb2fa7a17b758a948d7568b8b9715472a3f7) from 2,995,180 to 2,995,188. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 5b6a217.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-01 21:26:38 +00:00 (Migrated from github.com)

Reviewed and merged. Confirmed in build/43U/asm: addi r1, r1, 0x20 / blr at 0x815EADE4/E8 follow the old symbol end and precede pfd_sddrv_init_drv_tbl, so 0x188 is right; the return 0 change is the honest source form for the original's li r3, 0. Clean rebuild: DOL sha1 unchanged, sd_drv 20/26 exact. FYI I scanned every asm file for the same truncated-epilogue pattern (.endfn right after mtlr with addi r1, r1 following) and this and PFSYS_TimeStamp were the only two, so that class is done. Good next targets for you: units with 100% code whose data is genuinely wrong, or sd_drv's remaining six functions.

Reviewed and merged. Confirmed in build/43U/asm: `addi r1, r1, 0x20` / `blr` at 0x815EADE4/E8 follow the old symbol end and precede pfd_sddrv_init_drv_tbl, so 0x188 is right; the `return 0` change is the honest source form for the original's `li r3, 0`. Clean rebuild: DOL sha1 unchanged, sd_drv 20/26 exact. FYI I scanned every asm file for the same truncated-epilogue pattern (`.endfn` right after `mtlr` with `addi r1, r1` following) and this and PFSYS_TimeStamp were the only two, so that class is done. Good next targets for you: units with 100% code whose data is genuinely wrong, or sd_drv's remaining six functions.
Sign in to join this conversation.