decomp(bs2): preserve update publications and repeated entry reads #995

Merged
coah80 merged 1 commits from agent/bittle/bs2-update-publications into main 2026-10-02 23:49:17 +00:00
coah80 commented 2026-10-02 23:47:38 +00:00 (Migrated from github.com)

Target-evidenced declarations

Restore definition-level volatile on existing EntriesCount and State objects, and use vu32 for the actual shared BS2UpdateEntry.type field. No use-site qualifier casts or translation-unit-specific type split.

Independently checked original object offsets:

  • 0xC2C/0xC30: selected count store immediately followed by reload
  • 0x4F4 and0xB4C: failure-state publications retained before the later State=5 at0xC44; old source eliminated those two store sequences
  • 0xCE8 and0xD00: same entry.type loaded twice on the nonzero path, with no intervening call or write

Independent verification

Rebased on 3d3448e3a887ac5fb1d7011d2d518a183b6dcda5; tested tree 9754da7979.

  • UpdateThread:93.59803%→94.66265%;904→910/913 instructions
  • Unit fuzzy:94.23001%→95.18954%;9/10 exact functions and400/4052 exact code preserved
  • Data10488/10488 remains100%; all allocated non-text bytes and normalized relocations unchanged
  • Parent independently deleted and rebuilt all1027 configured source objects because of shared-header change; only BS2Update .text changed (4016→4040 bytes), all other objects/reports unchanged
  • Full43U build/report/progress/DOL pass; SHA1 26116613f624061ba99c8d1a299aaa6efa85670d
  • All9 exact functions retain ctxdiff zero; pool55/55 identical; literal audit5 arguments/no candidates/errors; worktree/diff checks pass

Partial source reconstruction; three address-materialization instructions and allocation/scheduling differences remain. No linking/configuration change or new storage/assembly. Historical worker log baseline is superseded by this parent validation. No merge performed or requested by this author.

Note

Mark BS2UpdateEntry.type, EntriesCount, and State as volatile

Declares shared state as volatile so the compiler keeps every read and write as an observable memory access. Marks BS2UpdateEntry.type as vu32 in BS2Update.h, and EntriesCount and State as volatile globals in BS2Update.c. Also adds an engineering report covering the rationale, measurements, and verification in bs2-update-publication-20261002.md. Behavioral Change: volatile access changes codegen around these symbols, so compare matching output when reviewing.

Macroscope summarized b6f0600.

## Target-evidenced declarations Restore definition-level volatile on existing EntriesCount and State objects, and use vu32 for the actual shared BS2UpdateEntry.type field. No use-site qualifier casts or translation-unit-specific type split. Independently checked original object offsets: - 0xC2C/0xC30: selected count store immediately followed by reload - 0x4F4 and0xB4C: failure-state publications retained before the later State=5 at0xC44; old source eliminated those two store sequences - 0xCE8 and0xD00: same entry.type loaded twice on the nonzero path, with no intervening call or write ## Independent verification Rebased on 3d3448e3a887ac5fb1d7011d2d518a183b6dcda5; tested tree 9754da79796e619bba10a4570a46389646ce0433. - UpdateThread:93.59803%→94.66265%;904→910/913 instructions - Unit fuzzy:94.23001%→95.18954%;9/10 exact functions and400/4052 exact code preserved - Data10488/10488 remains100%; all allocated non-text bytes and normalized relocations unchanged - Parent independently deleted and rebuilt all1027 configured source objects because of shared-header change; only BS2Update .text changed (4016→4040 bytes), all other objects/reports unchanged - Full43U build/report/progress/DOL pass; SHA1 26116613f624061ba99c8d1a299aaa6efa85670d - All9 exact functions retain ctxdiff zero; pool55/55 identical; literal audit5 arguments/no candidates/errors; worktree/diff checks pass Partial source reconstruction; three address-materialization instructions and allocation/scheduling differences remain. No linking/configuration change or new storage/assembly. Historical worker log baseline is superseded by this parent validation. 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] > ### Mark `BS2UpdateEntry.type`, `EntriesCount`, and `State` as volatile > Declares shared state as volatile so the compiler keeps every read and write as an observable memory access. Marks `BS2UpdateEntry.type` as `vu32` in [BS2Update.h](https://github.com/coah80/wii-ipl/pull/995/files#diff-81924507c12ec300be93041c940cb7d1969e5e16900249d212679f1dbe2012f2), and `EntriesCount` and `State` as volatile globals in [BS2Update.c](https://github.com/coah80/wii-ipl/pull/995/files#diff-f8ee0e16f8c7bf6d4550dc26e79302cd8368796e510ff1dbac111e8f06fc9acc). Also adds an engineering report covering the rationale, measurements, and verification in [bs2-update-publication-20261002.md](https://github.com/coah80/wii-ipl/pull/995/files#diff-9ac86211a679fb669613d603ee8eaa5d2164f22b346b1ba5d617ffd15cbca458). Behavioral Change: volatile access changes codegen around these symbols, so compare matching output when reviewing. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized b6f0600.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 23:49:15 +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.