Repository navigation
feat(libkernel): record exception handlers - #724
Merged
oneandonlydean merged 2 commits intoOct 6, 2026
Merged
oneandonlydean merged 2 commits into
oneandonlydean merged 2 commits into
Conversation
sceKernelInstallExceptionHandler and sceKernelRemoveExceptionHandler threw. They now keep one handler per allowed signal (SIGHUP, SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGUSR1, as in shadPS4): another signal or a null handler returns EINVAL, a second handler for a signal returns EAGAIN, and removing clears it. Delivery is not implemented and is recorded in the technical debt; sceKernelRaiseException still throws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 tasks done
Collaborator
|
Thanks for this. It needs a one-line rebase: #796 added its |
…/kernel-exception-handler-registration # Conflicts: # docs/dev/TechnicalDebt.md
Contributor
Author
|
Merged |
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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