feat(libkernel): implement siglongjmp #2935
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2935"
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?
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T18:34:52Z.
PokeMMO Prospero (PPSA98001) stops at
siglongjmp(pebqbE5ws8s,libkernel.prx) onmain, per @babyhuey's catalog run in #1578 (table, rowsiglongjmp, PPSA98001). This was posted there as a ready branch while intake was limited; it is still absent on currentmain, and no open PR implements it.What
The title links its own (FreeBSD)
sigsetjmpand imports onlysiglongjmp, sosiglongjmpmust read FreeBSD's amd64sigjmp_buflayout. That layout is:The function is a direct translation of FreeBSD's
__siglongjmp(lib/libc/amd64/gen/sigsetjmp.S), written in assembly inSignalSets.cpp:_sigprocmask(SIG_SETMASK, …);val, or 1 for 0.It differs from FreeBSD in one respect: it tests the 32-bit
valrather than all of%rsi, since the upper half is undefined for anintargument.Tested
guest_signal_setshas a verbatim copy of FreeBSD'ssigsetjmpin test assembly, standing in for the title's own. It checks that:siglongjmp(buf, 0)returns 1 andsiglongjmp(buf, 7)returns 7;sigsetjmpcomes back even after another mask was set;Without the change the test does not link. A mutant that skips the mask restore fails it.
Windows 11 (WinLibs GCC 15.2.0), Release:
guest_signal_setspasses 5/5 (--repeat until-fail:5),ctest -E "^agc_|video_out"297/297,check_conventions.pypasses, andpr_overlap.pyreports no overlap. On the fork CI run, the Linux job passes, which covers the@PLTcall path. The first Windows attempt hitguest_video_out_resolution_status(0xc0000374), which also fails on unmodifiedmainhere and passed in another run today. The rerun of the Windows job passes 573/573.Static check on the title. I relinked PPSA98001 v1.0.2 (sha256 checked against the catalog record,
eboot.binandlibc.prxunwrapped) with--registryon Windows and compared the imports with the built libraries usingtools/import_audit.py. The absent imports go from 11 onmain(c72d5ce1, and the same 11 onbc40a6b5) to 10 with this branch, andsiglongjmpis no longer among them. The remaining 10 areatol,atoll,getprogname,malloc_usable_size,sqrt,sqrtf,frexpl,_umtx_op,pthread_sigmaskandpthread_set_name_np, so the next runtime stop will be one of those. I did not execute the title.The branch is rebased onto current
main, andguest_signal_setspasses 3/3 there on Windows.Side note, not changed here: the existing
setjmp/longjmpinJumpBuffer.cppuse their ownjmp_buflayout. It saves rsp after the return address, and puts MXCSR at 64 and the x87 control word at 68. FreeBSD saves the stack pointer at the return slot, with the control word at 64 and MXCSR at 68. That is fine while both halves are ours, but a title that pairs its ownsetjmpwith ourlongjmp, or the reverse, would jump 8 bytes off. I can open an issue if that's worth tracking.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T18:56:58Z.
Full Linux and Windows builds and tests for this head (
0272f99a), using the project's Build workflow. I can't start the upstream manual run, so I ran the samebuild.ymlin my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into currentmain(bf6e25a1):ctest: 703/703 passedctest: 711/711 passedRun: https://github.com/AchrafReyani/AnyPS5/actions/runs/38076425655