MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fputrap_x87

Function fputrap_x87

freebsd/amd64/amd64/fpu.c:712–736  ·  view source on GitHub ↗

* Read the FP status and control words, then generate si_code value * for SIGFPE. The error code chosen will be one of the * FPE_... macros. It will be sent as the second argument to old * BSD-style signal handlers and as "siginfo_t->si_code" (second * argument) to SA_SIGINFO signal handlers. * * Some time ago, we cleared the x87 exceptions with FNCLEX there. * Clearing exceptions was nec

Source from the content-addressed store, hash-verified

710 * For XMM traps, the exceptions were never cleared.
711 */
712int
713fputrap_x87(void)
714{
715 struct savefpu *pcb_save;
716 u_short control, status;
717
718 critical_enter();
719
720 /*
721 * Interrupt handling (for another interrupt) may have pushed the
722 * state to memory. Fetch the relevant parts of the state from
723 * wherever they are.
724 */
725 if (PCPU_GET(fpcurthread) != curthread) {
726 pcb_save = curpcb->pcb_save;
727 control = pcb_save->sv_env.en_cw;
728 status = pcb_save->sv_env.en_sw;
729 } else {
730 fnstcw(&control);
731 fnstsw(&status);
732 }
733
734 critical_exit();
735 return (fpetable[status & ((~control & 0x3f) | 0x40)]);
736}
737
738int
739fputrap_sse(void)

Callers 1

trapFunction · 0.85

Calls 2

critical_enterFunction · 0.50
critical_exitFunction · 0.50

Tested by

no test coverage detected