mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-12-04 16:40:32 +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>
1.0 KiB
1.0 KiB
libkernel
change builds the handler's
- sceKernelRaiseException handler contexts are verified on the console only in the fields PS5Util reads;
mc_fpformatandmc_ownedfpare not measured. A handler leaving throughsigreturnorsetcontextunblocks every guest signal on its thread, asuc_sigmaskis empty where FreeBSD'ssendsigsaves 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 hasgetcontext's layout (mcontextat 0x40,mc_rspat 0xf8), setsmc_fpformatandmc_ownedfpto_MC_FPFMT_XMMand_MC_FPOWNED_FPU(FreeBSD reports_MC_FPOWNED_PCBwhen the FPU state was not live) and leavesmc_flags0, where FreeBSD sets_MC_HASSEGSand, with XSAVE,_MC_HASFPXSTATE. Returning loadsmc_fpstatewhatever the two fields say