decomp(ATERM): align case-six checksum initialization #1099

Merged
coah80 merged 1 commits from agent/bittle/aterm-checksum-init-order into main 2026-10-03 12:23:12 +00:00
coah80 commented 2026-10-03 12:21:37 +00:00 (Migrated from github.com)

One narrowly scoped initialization-order trial

Move only case6's existing private checksum = 0 declaration before the two SONtoHs conversion declarations. Packet reads, conversions, other source bytes, case8, types, helpers and configuration remain fixed. Exactly one candidate was tried.

  • RunConfigProtocol: 89.56257% → 89.57834%
  • Unit: 97.307434% → 97.31056%
  • Instructions remain 958 versus original951
  • Exact functions18/26, code11036/19204, data18584/18864 and linking unchanged

Original code initializes checksum before the conversions. Both original/current SONtoHs are pinned to register-only bytes5463043e4e800020, with no memory access or callbacks. The constant initialization has no escaping address and moves no packet/global observation. This is target-supported scheduling, not proof of unique original source ordering.

Independent parent verification

Rebased and freshly built on405fc376c5c2c475910065296e2d9cb566b94417. Tested tree279416f96c7daab52834dffc455e6c2dc59bf2eb.

  • All1,027 unit/function reports checked: no regressions, only RunConfigProtocol improves
  • Case8 and all siblings unchanged; allocated non-code bytes/extents/alignment and outside-header relocations preserved
  • Only25 instruction differences, confined to case6 indices414–492
  • Reordered header checked with64 sampled packet-header inputs; packet reads, conversion arguments and private sequence store observations agree
  • Remaining changed region is an exact r15/r16 renaming; post-region control-flow traversal verifies both differing saved-register values are overwritten before caller reads
  • All123 calls preserve sequence and identities; actual SONtoHs implementation pinned
  • Pool identical. Literal audit:24 functions/6 arguments, zero errors; existing unequal-size skips are DiscoverAccessPoints and RunConfigProtocol
  • Full default build/progress,43U/ok, main/leaf/diff checks pass
  • DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d

The sampled header checks and bounded CFG audit are not a general symbolic proof or protocol-runtime test. Evidence: tools/decomp-assist/aterm-case6-checksum-initialization.attempts.md. No original binaries/disassembly uploaded. Draft for human review; no merge or auto-merge requested.

Note

Align case-six checksum initialization in ATERMRunConfigProtocol

Moves the local checksum initialization in ATERMRunConfigProtocol so it sits right after the packet pointer declaration and before the sequence and payload-length SONtoHs conversions, matching the case-six ordering in ATERM.c. Adds an engineering evidence document for the candidate, including hashes, safety checks, and matching results, in aterm-case6-checksum-initialization.attempts.md. The checksum value stays a private zero-initialized scalar used by the existing checksum loop.

Macroscope summarized 97e3dea.

## One narrowly scoped initialization-order trial Move only case6's existing private checksum = 0 declaration before the two SONtoHs conversion declarations. Packet reads, conversions, other source bytes, case8, types, helpers and configuration remain fixed. Exactly one candidate was tried. - RunConfigProtocol: 89.56257% → 89.57834% - Unit: 97.307434% → 97.31056% - Instructions remain 958 versus original951 - Exact functions18/26, code11036/19204, data18584/18864 and linking unchanged Original code initializes checksum before the conversions. Both original/current SONtoHs are pinned to register-only bytes5463043e4e800020, with no memory access or callbacks. The constant initialization has no escaping address and moves no packet/global observation. This is target-supported scheduling, not proof of unique original source ordering. ## Independent parent verification Rebased and freshly built on405fc376c5c2c475910065296e2d9cb566b94417. Tested tree279416f96c7daab52834dffc455e6c2dc59bf2eb. - All1,027 unit/function reports checked: no regressions, only RunConfigProtocol improves - Case8 and all siblings unchanged; allocated non-code bytes/extents/alignment and outside-header relocations preserved - Only25 instruction differences, confined to case6 indices414–492 - Reordered header checked with64 sampled packet-header inputs; packet reads, conversion arguments and private sequence store observations agree - Remaining changed region is an exact r15/r16 renaming; post-region control-flow traversal verifies both differing saved-register values are overwritten before caller reads - All123 calls preserve sequence and identities; actual SONtoHs implementation pinned - Pool identical. Literal audit:24 functions/6 arguments, zero errors; existing unequal-size skips are DiscoverAccessPoints and RunConfigProtocol - Full default build/progress,43U/ok, main/leaf/diff checks pass - DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d The sampled header checks and bounded CFG audit are not a general symbolic proof or protocol-runtime test. Evidence: tools/decomp-assist/aterm-case6-checksum-initialization.attempts.md. No original binaries/disassembly uploaded. Draft for human review; no merge or auto-merge requested. <!-- 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] > ### Align case-six checksum initialization in `ATERMRunConfigProtocol` > Moves the local checksum initialization in `ATERMRunConfigProtocol` so it sits right after the packet pointer declaration and before the sequence and payload-length `SONtoHs` conversions, matching the case-six ordering in [ATERM.c](https://github.com/coah80/wii-ipl/pull/1099/files#diff-e67bb234e10edec28359a3022bc49117cf56df7cd361cea3415fc9a54636e50d). Adds an engineering evidence document for the candidate, including hashes, safety checks, and matching results, in [aterm-case6-checksum-initialization.attempts.md](https://github.com/coah80/wii-ipl/pull/1099/files#diff-ee6b8a9dfd1303ecff54fd03146cd097d994aafe033f7528d21d3800b517affe). The checksum value stays a private zero-initialized scalar used by the existing checksum loop. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 97e3dea.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 12:23:10 +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.