refactor(BS2): BS2Reboot uses the ES work-buffer idiom (swe2-reboot) #1239

Merged
coah80 merged 1 commits from agent/w0929/swe2-reboot-land into main 2026-10-06 18:25:06 +00:00
2 changed files with 24 additions and 4 deletions

View File

@@ -531,9 +531,7 @@ ESError BS2ESGetTicketViews(IOSFd *descriptor, ESTitleId titleId, ESTicketView *
}
void BS2Reboot(void) {
ESTicketView ticket ALIGN32;
struct {
ESTitleId title[32];
} launchWork ALIGN32;
u8 work[256] ALIGN32;
OSStateFlags flags ALIGN32;
IOSIoVector vectors[4] ALIGN32;
IOSFd descriptor;
@@ -580,7 +578,7 @@ void BS2Reboot(void) {
{
s32 launchResult;
IOSIoVector *request = vectors;
ESTitleId *title = launchWork.title;
ESTitleId *title = (ESTitleId *)work;
if (descriptor < 0) {
launchResult = -0x3f9;
} else if ((u32)&ticket % 32 != 0) {

View File

@@ -0,0 +1,22 @@
# swe2-reboot attempts — BS2Reboot (src/BS2/BS2Mach.c)
Integrity task: function already exact; replace dishonest
`struct { ESTitleId title[32]; } launchWork` carrier with honest storage.
Target disasm layout (0x280 frame):
- 0x20 ticketCount, 0x24 descriptor
- 0x40 vectors[4]
- 0x60 OSStateFlags flags (0x20)
- 0x80 title (ESTitleId, 8 bytes used of a 0x100 region)
- 0x180 ESTicketView ticket (0xD8)
The 0x100 title region matches the SDK ES work-buffer size. es.c uses
`u8 __esWork[256] ALIGN32` (DECLARE_ES_WORK) with the title at +0x00 for
ES_LaunchTitle; BS2ESGetTicketViews in the same file already uses the same
`u8 work[256] ALIGN32` idiom.
| # | Change | differing |
|---|--------|-----------|
| 1 | `u8 work[256] ALIGN32` in place of launchWork; `ESTitleId *title = (ESTitleId *)work` | 0 / 137 |
Exact on first attempt. pool_diff: no divergence.