feat(libkernel): record exception handlers #724
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/724"
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 merwie on 2026-10-05T18:01:19Z.
What
sceKernelInstallExceptionHandlerandsceKernelRemoveExceptionHandlerthrewnot implemented. They now keep one handler per allowed signal, with the checks of shadPS4's implementation:SCE_KERNEL_ERROR_EINVAL;SCE_KERNEL_ERROR_EAGAIN;Nothing delivers to the recorded handler yet: a host fault still ends the process with the crash report, and
sceKernelRaiseExceptionstill throws. This is recorded under Functional in TechnicalDebt.guest_exception_handler: rejected signals and null handler, install / duplicate / remove / reinstall for each allowed signal.Why registration alone is useful, and what delivery needs: PPSA12544's
Media/Modules/PS5Util.prx(Unity) installs a SIGUSR1 handler in its GC stop init (gc_stop_init failure 1 error:%xon failure). Its handler checkssignum == 30and calls the stored callback with the context and*(context + 0xf8), i.e.uc_mcontext.mc_rspof the PS5ucontext(16-byteuc_sigmask, 48 bytes, thenuc_mcontext). To stop a thread for garbage collection it callssceKernelRaiseException(thread, 30). Delivery therefore has to run the handler on the target thread with the interrupted state and resume it afterwards; on Windows the targets are typically blocked in host waits (seen:AssetGarbageCollectorHelperthreads inntdllwaits). That design is a separate change, proposed in #727.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Ryzen 7 9800X3D, Radeon RX 9070 XT.
ctest: 289/291 passed, includingguest_exception_handler.agc_driver_lds_atomics64andagc_driver_vopc_compare_tablefail on this machine onmainas well (Vulkan device tests).sceKernelRaiseException(thread, 30), which throws.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 oneandonlydean on 2026-10-06T05:34:21Z.
Thanks for this. It needs a one-line rebase: #796 added its
Additional content(libSceAppContent) line todocs/dev/TechnicalDebt.mdat the same place in the Functional list as yoursceKernelInstallExceptionHandlerline. Keeping both lines resolves it, and nothing else conflicts. #760 carries this commit, so it will need the same resolution.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T07:55:09Z.
Progress report (
481c85e→deddb10)📈 System libraries: 82.37% (+0.06%, +2 implemented functions)
✅ 2 implemented
sceKernelInstallExceptionHandlersceKernelRemoveExceptionHandlerImported from boykopovar/AnyPS5. Originally posted by merwie on 2026-10-06T07:59:49Z.
Merged
main(a merge, not a rebase, so the review history stays) and kept bothTechnicalDebt.mdlines in the order you suggested. Nothing else changed.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T08:58:50Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/TechnicalDebt.mdL138