From d29f93afe9078b0c6d7e89ac96c124529ee05fc0 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 8 Oct 2026 23:17:58 +0000 Subject: [PATCH] decomp(bs2): replace UpdateThread scratch carrier with ordinary locals (worker 7af05191) --- src/BS2/BS2Update.c | 166 ++++++++++++------------- tools/decomp-assist/sol-z1.attempts.md | 128 +++++++++++++++++++ 2 files changed, 207 insertions(+), 87 deletions(-) create mode 100644 tools/decomp-assist/sol-z1.attempts.md diff --git a/src/BS2/BS2Update.c b/src/BS2/BS2Update.c index 9967e15c..41368c2b 100644 --- a/src/BS2/BS2Update.c +++ b/src/BS2/BS2Update.c @@ -16,7 +16,7 @@ static u8 ThreadStack[4096] = {0}; static BS2UpdateHeader UpdateHeader0 ALIGN32 = {0}; static BS2UpdateHeader UpdateHeader1 ALIGN32 = {0}; -#define UPDATE_DISC_ENTRIES ((BS2UpdateEntry*)0x80480000) +BS2UpdateEntry DiscEntries[BS2_UPDATE_ENTRY_COUNT] ADDRESS(0x80480000); s32 WADCheckImport(u64 titleId, u16 titleVersion); s32 WADImportDVDForBS(const char* path, void* buffer, u32 length); @@ -32,8 +32,8 @@ static u32 RebootRequired = 0; static BOOL ContainsSeatTitles = 0; static u32 UpdateImportState = 0; static u32 UpdateImportResult = 0; -u32 StartUpdate = 0; -u32 CancelUpdate = 0; +volatile u32 StartUpdate = 0; +volatile u32 CancelUpdate = 0; static u32 UpdateProgress = 0; static volatile s32 rc = 0; static u64 VersionIOS = 0; @@ -66,7 +66,7 @@ void BS2UpdateInit(void* allocator) { CurrentEntry = NULL; pEntries = NULL; EntriesCount = 0; - memset(UPDATE_DISC_ENTRIES, 0, 0x40000); + memset(DiscEntries, 0, 0x40000); memset(EntriesToImport, 0, 0x40000); memset(Flags1, 0, sizeof(Flags1)); BS2Report("Create update thread\n"); @@ -76,45 +76,42 @@ void BS2UpdateInit(void* allocator) { } static inline u32 BS2SelectUpdateEntries(void) { - BOOL missingFile; + u32 index; u32 selectedCount; u32 requiredBytes; u32 requiredInodes; u32 channelCount; - u32 index; BS2UpdateEntry* seatEntries; BS2UpdateEntry* selectedSeats; u32 selectedSeatCount; BOOL regionValid; u32 titleRegion; - struct { - u32 freeChannels; - u32 freeBlocks; - u32 freeInodes; - u32 ticketCount; - char productArea[8]; - u64 titleId; - char updatePath[32]; - char seatPath[32]; - DVDFileInfo file; - } scratch; + u32 freeChannels; + u32 freeBlocks; + u32 freeInodes; + u32 ticketCount; + char productArea[8]; + u64 titleId; + char updatePath[32]; + char seatPath[32]; + DVDFileInfo file; missingFile = FALSE; selectedCount = 0; requiredBytes = 0; requiredInodes = 0; channelCount = 0; - scratch.freeChannels = 0; - scratch.freeBlocks = 0; - scratch.freeInodes = 0; + freeChannels = 0; + freeBlocks = 0; + freeInodes = 0; selectedSeatCount = 0; State = 0; ContainsSeatTitles = FALSE; - if (ES_GetTitleId(&scratch.titleId) != ES_ERR_OK) { + if (ES_GetTitleId(&titleId) != ES_ERR_OK) { regionValid = FALSE; } else { - titleRegion = (u8)scratch.titleId; + titleRegion = (u8)titleId; switch (SCGetProductArea()) { case SC_PRODUCT_AREA_JPN: case SC_PRODUCT_AREA_TWN: @@ -159,23 +156,23 @@ product_region_checked: selectedCount = 0; goto selection_complete; } - if (!SCGetProductAreaString(scratch.productArea, sizeof(scratch.productArea))) { + if (!SCGetProductAreaString(productArea, sizeof(productArea))) { BS2Report("Error: failed to get product information."); selectedCount = 0; goto selection_complete; } - strcpy(scratch.updatePath, "__update.inf"); - strcat(scratch.updatePath, "."); - strcat(scratch.updatePath, scratch.productArea); - if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) { + strcpy(updatePath, "__update.inf"); + strcat(updatePath, "."); + strcat(updatePath, productArea); + if (DVDConvertPathToEntrynum(updatePath) < 0) { switch (SCGetProductArea()) { case 0: case 1: case 2: case 6: case 11: - strcpy(scratch.updatePath, "__update.inf"); - if (DVDConvertPathToEntrynum(scratch.updatePath) < 0) { + strcpy(updatePath, "__update.inf"); + if (DVDConvertPathToEntrynum(updatePath) < 0) { BS2Report("Error: update information file is not found."); selectedCount = 0; goto selection_complete; @@ -187,13 +184,13 @@ product_region_checked: goto selection_complete; } } - BS2Report("%s is found.\n", scratch.updatePath); - if (!DVDOpen(scratch.updatePath, &scratch.file)) { + BS2Report("%s is found.\n", updatePath); + if (!DVDOpen(updatePath, &file)) { BS2Report("Error: failed to open update information file."); selectedCount = 0; goto selection_complete; } - if (DVDReadPrio(&scratch.file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) { + if (DVDReadPrio(&file, &UpdateHeader0, sizeof(UpdateHeader0), 0, 2) < 0) { BS2Report("Error: failed to read update information header."); selectedCount = 0; goto selection_complete; @@ -214,25 +211,24 @@ product_region_checked: selectedCount = 0; goto selection_complete; } - if (DVDReadPrio(&scratch.file, UPDATE_DISC_ENTRIES, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) { + if (DVDReadPrio(&file, DiscEntries, UpdateHeader0.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) { BS2Report("Error: failed to read update information."); selectedCount = 0; goto selection_complete; } { - BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES; for (index = 0; index < UpdateHeader0.wadCount; index++) { - if ((discEntries[index].attr & 1) == 0) { + if ((DiscEntries[index].attr & 1) == 0) { continue; } switch (OSGetPhysicalMem2Size()) { case 0x4000000: - if ((discEntries[index].depend & 1) == 0) { + if ((DiscEntries[index].depend & 1) == 0) { continue; } break; case 0x8000000: - if ((discEntries[index].depend & 2) == 0) { + if ((DiscEntries[index].depend & 2) == 0) { continue; } break; @@ -242,37 +238,37 @@ product_region_checked: selectedCount = 0; goto selection_complete; } - if (DVDOpen(discEntries[index].path, &scratch.file) < 0) { - BS2Report("%s is not found\n", discEntries[index].path); + if (DVDOpen(DiscEntries[index].path, &file) < 0) { + BS2Report("%s is not found\n", DiscEntries[index].path); missingFile = TRUE; continue; } - discEntries[index].size = scratch.file.length; - if (discEntries[index].type == 0) { + DiscEntries[index].size = file.length; + if (DiscEntries[index].type == 0) { selectedCount++; - } else if (WADCheckImport(discEntries[index].titleId, discEntries[index].titleVersion) == 0) { - BS2Report("%s is already installed\n", discEntries[index].path); + } else if (WADCheckImport(DiscEntries[index].titleId, DiscEntries[index].titleVersion) == 0) { + BS2Report("%s is already installed\n", DiscEntries[index].path); Flags1[index] = 0; } else { - BS2Report("%s\n", discEntries[index].path); - memcpy(&EntriesToImport[selectedCount], &discEntries[index], sizeof(BS2UpdateEntry)); + BS2Report("%s\n", DiscEntries[index].path); + memcpy(&EntriesToImport[selectedCount], &DiscEntries[index], sizeof(BS2UpdateEntry)); selectedCount++; Flags1[index] = 1; } } } - strcpy(scratch.seatPath, "__seatholder.inf"); - strcat(scratch.seatPath, "."); - strcat(scratch.seatPath, scratch.productArea); - if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) { + strcpy(seatPath, "__seatholder.inf"); + strcat(seatPath, "."); + strcat(seatPath, productArea); + if (DVDConvertPathToEntrynum(seatPath) < 0) { switch (SCGetProductArea()) { case 0: case 1: case 2: case 6: case 11: - strcpy(scratch.seatPath, "__seatholder.inf"); - if (DVDConvertPathToEntrynum(scratch.seatPath) < 0) { + strcpy(seatPath, "__seatholder.inf"); + if (DVDConvertPathToEntrynum(seatPath) < 0) { BS2Report("Error: update seatholder information file is not found."); goto seats_done; } @@ -282,12 +278,12 @@ product_region_checked: goto seats_done; } } - BS2Report("%s is found.\n", scratch.seatPath); - if (!DVDOpen(scratch.seatPath, &scratch.file)) { + BS2Report("%s is found.\n", seatPath); + if (!DVDOpen(seatPath, &file)) { BS2Report("Error: failed to open update information file."); goto seats_done; } - if (DVDReadPrio(&scratch.file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) { + if (DVDReadPrio(&file, &UpdateHeader1, sizeof(UpdateHeader1), 0, 2) < 0) { BS2Report("Error: failed to read update information header."); goto seats_done; } @@ -300,11 +296,9 @@ product_region_checked: BS2Report("Error: found too many extra entries."); goto seats_done; } - seatEntries = UPDATE_DISC_ENTRIES; - seatEntries += UpdateHeader0.wadCount; - selectedSeats = EntriesToImport; - selectedSeats += selectedCount; - if (DVDReadPrio(&scratch.file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) { + seatEntries = DiscEntries + UpdateHeader0.wadCount; + selectedSeats = EntriesToImport + selectedCount; + if (DVDReadPrio(&file, seatEntries, UpdateHeader1.wadCount * sizeof(BS2UpdateEntry), 32, 2) < 0) { BS2Report("Error: failed to read update information."); goto seats_done; } @@ -337,7 +331,7 @@ product_region_checked: State = 5; goto seats_done; } - if (DVDOpen(seatEntries[index].path, &scratch.file) < 0) { + if (DVDOpen(seatEntries[index].path, &file) < 0) { BS2Report("%s is not found\n", seatEntries[index].path); missingFile = TRUE; continue; @@ -345,11 +339,11 @@ product_region_checked: if (seatEntries[index].type != 7) { continue; } - if (ES_GetTicketViews(seatEntries[index].titleId, NULL, &scratch.ticketCount) != ES_ERR_OK) { + if (ES_GetTicketViews(seatEntries[index].titleId, NULL, &ticketCount) != ES_ERR_OK) { BS2Report("Faild to get eTicket views.\n"); continue; } - if (scratch.ticketCount != 0) { + if (ticketCount != 0) { continue; } if (SCGetWwwRestriction() && ((u32)(seatEntries[index].titleId & 0xFFFFFFFFULL) & 0xFFFFFF00) == 0x48414400) { @@ -372,23 +366,23 @@ product_region_checked: requiredInodes += seatEntries[index].inodes; } if (channelCount != 0) { - if (!SCGetFreeChannelAppCount(&scratch.freeChannels)) { + if (!SCGetFreeChannelAppCount(&freeChannels)) { BS2Report("Error: cannot get channel count."); goto seats_done; } - if (NANDSecretGetUserAvailableArea(&scratch.freeBlocks, &scratch.freeInodes) != NAND_RESULT_OK) { + if (NANDSecretGetUserAvailableArea(&freeBlocks, &freeInodes) != NAND_RESULT_OK) { BS2Report("Error: cannot get free user blocks."); goto seats_done; } - if ((scratch.freeBlocks << 14) < 0x1004000 || requiredBytes > (scratch.freeBlocks << 14) - 0x1004000) { + if ((freeBlocks << 14) < 0x1004000 || requiredBytes > (freeBlocks << 14) - 0x1004000) { BS2Report("Sufficient user blocks doesn't exist."); goto seats_done; } - if (scratch.freeInodes < requiredInodes + 36) { + if (freeInodes < requiredInodes + 36) { BS2Report("Sufficient user inodes doesn't exist."); goto seats_done; } - if (channelCount > scratch.freeChannels) { + if (channelCount > freeChannels) { BS2Report("No enough blank channel."); goto seats_done; } @@ -410,14 +404,13 @@ seats_done: pEntries = EntriesToImport; pFlags = Flags1; { - BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES; for (index = 0; index < UpdateHeader0.wadCount; index++) { if (Flags1[index] == 1) { - BS2Report("File: %s\n", discEntries[index].path); - BS2Report("Name: %s\n", discEntries[index].dataName); - BS2Report("Info: %s\n", discEntries[index].dataMeta); - BS2Report("Attr: %s\n", (discEntries[index].attr & 1) ? "Critical" : "Non critical"); - BS2Report(" %s\n", (discEntries[index].attr & 2) ? "Reboot" : "Not reboot"); + BS2Report("File: %s\n", DiscEntries[index].path); + BS2Report("Name: %s\n", DiscEntries[index].dataName); + BS2Report("Info: %s\n", DiscEntries[index].dataMeta); + BS2Report("Attr: %s\n", (DiscEntries[index].attr & 1) ? "Critical" : "Non critical"); + BS2Report(" %s\n", (DiscEntries[index].attr & 2) ? "Reboot" : "Not reboot"); } } } @@ -442,25 +435,24 @@ static void* UpdateThread(void* argument) { State = 1; UpdateProgress = 0; { - BS2UpdateEntry *discEntries = UPDATE_DISC_ENTRIES; for (;;) { if (StartUpdate != 0) { if (UpdateProgress < UpdateHeader0.wadCount) { BS2Report("Progress : %d\n", UpdateProgress); if (Flags1[UpdateProgress] == 1) { - const char* path = discEntries[UpdateProgress].path; + const char* path = DiscEntries[UpdateProgress].path; BS2Report("Import : %s\n", path); State = 2; - CurrentEntry = &discEntries[UpdateProgress]; - if (discEntries[UpdateProgress].type == 0) { + CurrentEntry = &DiscEntries[UpdateProgress]; + if (DiscEntries[UpdateProgress].type == 0) { UpdateProgress++; continue; } - if (((const BS2UpdateEntry *)discEntries)[UpdateProgress].type == 1) { + if (((const BS2UpdateEntry *)DiscEntries)[UpdateProgress].type == 1) { BS2Report("BS2WADImportDVD : "); index = UpdateProgress; - if (strcmp(getSuffix(discEntries[index].path), "wad") == 0) { - importResult = WADImportDVDForBS(discEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000); + if (strcmp(getSuffix(DiscEntries[index].path), "wad") == 0) { + importResult = WADImportDVDForBS(DiscEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000); } else { importResult = 0; } @@ -468,20 +460,20 @@ static void* UpdateThread(void* argument) { BS2Report("rc = %d\n", rc); if (rc != 0) { NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d", - rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5); + rc, DiscEntries[UpdateProgress].titleId, "BS2Update.c", 0x3F5); State = 5; UpdateProgress = UpdateHeader0.wadCount + 1; break; } - if ((discEntries[UpdateProgress].attr & 2) != 0) { + if ((DiscEntries[UpdateProgress].attr & 2) != 0) { RebootRequired = 1; } UpdateProgress++; } else { BS2Report("BS2WADImportDVDEx : "); index = UpdateProgress; - if (strcmp(getSuffix(discEntries[index].path), "wad") == 0) { - importResult = WADImportDVDExForBS(discEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000); + if (strcmp(getSuffix(DiscEntries[index].path), "wad") == 0) { + importResult = WADImportDVDExForBS(DiscEntries[index].path, (void*)BS2_UPDATE_ADDRESS, 0x80000); } else { importResult = 0; } @@ -489,18 +481,18 @@ static void* UpdateThread(void* argument) { BS2Report("rc = %d\n", rc); if (rc != 0) { NANDLoggingAddMessageAsync(NULL, "BS2 error. [%d] titleID: 0x%016llx %s line: %d", - rc, discEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F); + rc, DiscEntries[UpdateProgress].titleId, "BS2Update.c", 0x40F); State = 5; UpdateProgress = UpdateHeader0.wadCount + 1; break; } - if ((discEntries[UpdateProgress].attr & 2) != 0) { + if ((DiscEntries[UpdateProgress].attr & 2) != 0) { RebootRequired = 1; } UpdateProgress++; } } else { - const char* path = discEntries[UpdateProgress].path; + const char* path = DiscEntries[UpdateProgress].path; BS2Report("Not import : %s\n", path); UpdateProgress++; } diff --git a/tools/decomp-assist/sol-z1.attempts.md b/tools/decomp-assist/sol-z1.attempts.md new file mode 100644 index 00000000..3c518cdd --- /dev/null +++ b/tools/decomp-assist/sol-z1.attempts.md @@ -0,0 +1,128 @@ +# sol-z1 UpdateThread integrity cleanup + +Worktree `/mnt/drive2/projects/wii-ipl-workers/data-d10`, branch `agent/w1009/data-d10-c`, base `c723136f`. Own `src/BS2/BS2Update.c` and this log. Read sol-common, brief-v2, all levers, local AGENTS.md, effort policy, earlier UpdateThread notes, both sol-x8 rounds and sol-y3 log recovered with `git show 4925fde2:tools/decomp-assist/sol-y3.attempts.md`. Applied unslop and writing-for-agents. Fetched only the fork under `/tmp/wii-git.lock`. No push, PR, merge, rebase, subagents, shared header changes or other-worktree writes. + +The explicit task authorizes committing this integrity cleanup even without an exact UpdateThread match. It overrides brief-v2's default instruction to restore nonexact source. The requested final gate is `gate.py src/BS2/BS2Update --quick`. + +## Prior evidence + +Do not repeat the logged restrict/const pointers, flag helpers, primitive/enum types, volatile-bank diagnostics, entry wrappers, whole-table seat indexing, bitfield views, cursors, source order variants or optimizer sweeps. sol-x8 and sol-y3 both already flattened the scratch carrier in their saved best. Neither source candidate was landed; main still has the carrier. The saved sol-y3 diff applies cleanly and already contains the required ordinary locals. This round independently verifies that order and commits the valid cleanup. + +## Compiled trials + +1. Fresh rebuild of HEAD: UpdateThread 335/913 differing, source 911 versus target 913 instructions, size 0xe3c versus 0xe44. No inherited source object used as measurement. +2. Apply sol-y3.BS2Update.diff: 6/913, equal 913 instructions and size 0xe44, pools 55/55 identical. All scratch members are separate ordinary locals. The three scheduling swaps are unchanged after cleanup. +3. Correct saved titleRegion indentation and remove extra blank lines: 6/913, 913/913. +4. Restore original static linkage for rc, VersionIOS, VersionMEM2, VersionES and ConsoleType: 6/913, 913/913. All other nine functions instruction exact. Keep this narrower change; the saved external-linkage edits were unnecessary. +5. Restore original external linkage of getSuffix: 6/913, 913/913. Keep original linkage; changing it was unnecessary. +6. Read a named ordinary attributes scalar after the diagnostic reports and before clearing Flags0, then test that value: 7/913, 913/913. Address add moves before the store, but load and bit test also precede it. Reject and restore trial 5. + +No declaration permutation is needed: the supplied ordinary declarations already reproduce every target stack access. No carrier, dummy object, padding, helper that merely hoists locals, added pragma or assembly is retained. Configure remains NonMatching because UpdateThread is not exact. + +## Target stack layout + +Source declaration order: freeChannels, freeBlocks, freeInodes, ticketCount, productArea[8], titleId, updatePath[32], seatPath[32], DVDFileInfo file. MWCC assigns these independent objects the target offsets without a wrapper. + +| Object | r1 offset | Size | Target use | +| --- | --- | --- | --- | +| freeChannels | 0x08 | 4 | Zero store, SCGetFreeChannelAppCount argument, channel limit load | +| freeBlocks | 0x0c | 4 | Zero store, NAND area output, available byte limit load | +| freeInodes | 0x10 | 4 | Zero store, NAND area output, inode limit load | +| ticketCount | 0x14 | 4 | ES_GetTicketViews output and count load | +| productArea | 0x18 | 8 | SCGetProductAreaString output and both strcat sources | +| titleId | 0x20 | 8 | ES_GetTitleId output; low word loaded at 0x24 | +| updatePath | 0x28 | 32 | Update path construction, entry lookup, report and DVDOpen | +| seatPath | 0x48 | 32 | Seat path construction, entry lookup, report and DVDOpen | +| file | 0x68 | 0x3c | DVD open/read arguments; length loaded at 0x9c | + +Frame is 0xf0. LR slot is 0xf4. _savegpr_14/_restgpr_14 use r11 = r1 + 0xf0. The disassembly audit below records every explicit r1 access, including frame and LR operations. + +## Remaining differences + +913/913 instructions, equal 0xe44 size. Differences 442/443 exchange Flags0 clear and seat attribute address add. Differences 545/546 exchange constant-one load and selected seat address add. Differences 549/550 exchange selected output offset increment and seat size load. Registers and operands match otherwise. Ordinary stack objects do not remove these previously documented seat-memory scheduling dependencies. + +## Final validation + +Requested quick gate passed on the retained source. Full 43U build passed; DOL SHA1 is `26116613f624061ba99c8d1a299aaa6efa85670d`. Pools are identical. UpdateThread is 99.33625% fuzzy with 6 differences, not exact; unit remains 9/10 exact functions, code 400/4052, data 10488/10488, linked code 0. All data sections are 100%. Global regressions, forbidden additions and readability warnings are zero. Fresh `ninja progress build/43U/report.json` and ctxdiff confirm those results. + +The only retained definition-level qualifiers are StartUpdate and CancelUpdate. Public BS2StartUpdate/BS2CancelUpdate APIs write them while UpdateThread polls them. Their target-proven independent zero stores and polling/exit schedule reproduce the saved best; all other unit functions remain exact. No use-site volatile cast was added. + +DiscEntries is the actual existing 512-entry disc table at 0x80480000, stride 0x200. Target memset covers 0x40000 bytes and DVDReadPrio fills the table. The declaration follows the same ADDRESS convention as Entries/EntriesToImport in the existing header and adds no allocated section storage. Direct typed accesses restore the target logging address rematerialization. Combined seat/output initializers compute the same pointers as the former assignment-plus-increment statements. No operation, string, error path, counter or call argument changes meaning. + +```text +full build: ok +main.dol sha1: 26116613f624061ba99c8d1a299aaa6efa85670d +[src/BS2/BS2Update] pool: IDENTICAL +[src/BS2/BS2Update] objdiff: code 400/4052 data 10488/10488 functions 9/10 fuzzy 99.4018 linked code 0 +[src/BS2/BS2Update] instruction-exact functions: 9/10 +[src/BS2/BS2Update] section .bss size 9056 match 100.0 +[src/BS2/BS2Update] section .data size 1328 match 100.0 +[src/BS2/BS2Update] section .sbss size 80 match 100.0 +[src/BS2/BS2Update] section .sdata size 24 match 100.0 +[src/BS2/BS2Update] section .text size 4052 match 99.40178 +[src/BS2/BS2Update] below 100: UpdateThread 99.33625 +[src/BS2/BS2Update] baseline: code 400/4052 data 10488 functions 9 fuzzy 95.7088 +regressions vs baseline: 0 +global matched_code_percent: 97.95043 -> 97.95043 +global fuzzy_match_percent: 99.90734 -> 99.91234 +global complete_code_percent: 89.90470 -> 89.90470 +global matched_data_percent: 100.00000 -> 100.00000 +forbidden patterns added (net, per file): 0 +readability warnings (net, per file; must be 0 in the final result): 0 +review note: src/BS2/BS2Update.c: volatile object declaration (orchestrator checks the target really re-reads it) (+2 net), e.g. volatile u32 StartUpdate = 0; +GATE PASS +``` + +### Complete explicit stack-access audit + +Target/source both 47 explicit stack instructions, equal at every ordinal. + +```text + 0 stwu r1, -0xf0(r1) + 2 stw r0, 0xf4(r1) + 3 addi r11, r1, 0xf0 + 15 addi r3, r1, 0x20 + 22 stw r15, 8(r1) + 24 stw r15, 0xc(r1) + 25 stw r15, 0x10(r1) + 33 lwz r0, 0x24(r1) + 79 addi r3, r1, 0x18 + 89 addi r3, r1, 0x28 + 92 addi r3, r1, 0x28 + 95 addi r3, r1, 0x28 + 96 addi r4, r1, 0x18 + 98 addi r3, r1, 0x28 +115 addi r3, r1, 0x28 +118 addi r3, r1, 0x28 +133 addi r4, r1, 0x28 +136 addi r3, r1, 0x28 +137 addi r4, r1, 0x68 +146 addi r3, r1, 0x68 +185 addi r3, r1, 0x68 +236 addi r4, r1, 0x68 +248 lwz r0, 0x9c(r1) +290 addi r3, r1, 0x48 +293 addi r3, r1, 0x48 +296 addi r3, r1, 0x48 +297 addi r4, r1, 0x18 +299 addi r3, r1, 0x48 +316 addi r3, r1, 0x48 +319 addi r3, r1, 0x48 +332 addi r4, r1, 0x48 +335 addi r3, r1, 0x48 +336 addi r4, r1, 0x68 +344 addi r3, r1, 0x68 +381 addi r3, r1, 0x68 +472 addi r4, r1, 0x68 +488 addi r6, r1, 0x14 +499 lwz r0, 0x14(r1) +562 addi r3, r1, 8 +570 addi r3, r1, 0xc +571 addi r4, r1, 0x10 +579 lwz r4, 0xc(r1) +593 lwz r3, 0x10(r1) +601 lwz r0, 8(r1) +907 addi r11, r1, 0xf0 +909 lwz r0, 0xf4(r1) +911 addi r1, r1, 0xf0 +``` -- 2.49.1