mirror of
https://github.com/sp00nznet/xboxrecomp.git
synced 2026-12-04 01:16:20 +00:00
54b64ca09f
POP32 assigned dst before adding 4 to sp, so a lifted `pop esp` left esp at the popped value + 4. The SDM has POP ESP load esp with the value read from the old top of stack. Spartan: Total Warrior's round-to-int helper (push esp; push eax; fld; frndint; fistp [esp]; pop eax; pop esp) returned with esp off by 4, which put a garbage edi into a heap free. POP32 now reads into a temporary, bumps sp, then writes dst; every other destination behaves as before, and -O3 code is the same size. Tests: the new ctest tests/stack_ops runs the lifter's emitted stack statements (push/pop esp, the round-to-int idiom, an ordinary pop, push/pop [esp+4], leave, pushad/popad) over a fake guest stack; the old macro fails its three pop-esp checks. docs/pipeline/04-lifting.md and docs/technical/register-model.md show the new macro. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>