* 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
| 710 | * For XMM traps, the exceptions were never cleared. |
| 711 | */ |
| 712 | int |
| 713 | fputrap_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 | |
| 738 | int |
| 739 | fputrap_sse(void) |
no test coverage detected