ps2pack stub: set up its own stack before unpacking #2
Loading…
Reference in a new issue
No description provided.
Delete branch "ps2pack-own-stack"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The ps2pack stub jumped straight into unpacking on whatever stack the launcher gave it. If that stack is in low memory (below 1 MB), a payload linked there is unpacked over the stub's own stack. ps2link links at 0x94000 by default, so a packed ps2link went black on hardware, while a packed program at 0x100000 or above (all four hwhello ELFs) worked.
The previous ps2-packer stub, disassembled from a known-good
PS2LINK.ELF, starts withSetupThread(stack at the top of RAM, 128 KB) andeibefore it decompresses. This does the same:crt0.snow callsSetupThreadwith a top-of-RAM stack, after clearing its bss and saving argc/argv, then callsmain. The entry point is unchanged (0x1D0001C).Verified in PCSX2: packed hello and packed ps2link (low address, all modules load, no exceptions) still start.
Not verified on hardware: whether this is the cause of the black screen. A test kit (old stub vs new stub, low address) is in scratch/blackscreen-kit4; results decide whether this is the fix. Please hold the merge until then.
35480d8ca13868d489ec