mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-12-05 00:50:52 +00:00
Every context handed to a guest exception handler carried a 512-byte FXSAVE image but left mc_fpformat and mc_ownedfp at 0. The tree's own sigreturn rejects a context whose format is not _MC_FPFMT_XMM, so a handler that resumed through sigreturn of the context it was given got EINVAL. FreeBSD 11.4's sendsig fills both fields through get_fpcontext. CallHandler now sets mc_fpformat to _MC_FPFMT_XMM (0x10002) and mc_ownedfp to _MC_FPOWNED_FPU (0x20001), as getcontext here already does. The constants move from UserContext.cpp to UserContext.hpp. Tests check the two fields in raise and fault handlers and resume a fault handler through sigreturn of its own context. The debt entry for handler contexts states what is still unmeasured or different. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
6 lines
1.0 KiB
Markdown
6 lines
1.0 KiB
Markdown
# libkernel
|
|
|
|
## change builds the handler's
|
|
|
|
- [sceKernelRaiseException](../../../core/libs/prx/libkernel/System/src/Exception.cpp) handler contexts are verified on the console only in the fields PS5Util reads; `mc_fpformat` and `mc_ownedfp` are not measured. A handler leaving through `sigreturn` or `setcontext` unblocks every guest signal on its thread, as `uc_sigmask` is empty where FreeBSD's `sendsig` saves the old mask; after a raise it keeps host SIGUSR1 blocked on Linux and macOS, losing later raises to that thread, and on Windows, after a raise on the calling thread or in a libkernel wait, resumes before the delivery and runs again (untested). Every handler context has `getcontext`'s layout (`mcontext` at 0x40, `mc_rsp` at 0xf8), sets `mc_fpformat` and `mc_ownedfp` to `_MC_FPFMT_XMM` and `_MC_FPOWNED_FPU` (FreeBSD reports `_MC_FPOWNED_PCB` when the FPU state was not live) and leaves `mc_flags` 0, where FreeBSD sets `_MC_HASSEGS` and, with XSAVE, `_MC_HASFPXSTATE`. Returning loads `mc_fpstate` whatever the two fields say
|