361 case (unsigned long)SIG_DFL: 362 /* simulate trap with no handler installed */ 363 sigaction(SIGFPE, &act, NULL); 364 kill(getpid(), SIGFPE); 365 break; 366 #if !defined(__lint) 367 case (unsigned long)SIG_IGN: 368 break; 369 #endif 370 default: 371 act.sa_handler(sig, sip, uap); 372 } 373 } 374 375 #elif defined(__x86) 376 377 #if defined(__amd64) 378 #define test_sse_hw 1 379 #else 380 extern int _sse_hw; 381 #define test_sse_hw &_sse_hw && _sse_hw 382 #endif 383 384 #if !defined(REG_PC) 385 #define REG_PC EIP 386 #endif 387 388 /* 389 * If a handling mode is in effect, apply it; otherwise invoke the 390 * saved handler 391 */ 392 static void 393 __fex_hdlr(int sig, siginfo_t *sip, ucontext_t *uap) 394 { 395 struct fex_handler_data *thr_handlers; 396 struct sigaction act; 397 void (*handler)(), (*simd_handler[4])(); 398 int mode, simd_mode[4], i, len, accrued, *ap; 399 unsigned int cwsw, oldcwsw, mxcsr, oldmxcsr; 400 enum fex_exception e, simd_e[4]; 401 fex_info_t info, simd_info[4]; 402 unsigned long addr; 403 siginfo_t osip = *sip; 404 sseinst_t inst; 405 406 /* check for an exception caused by an SSE instruction */ 407 if (!(uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.status & 0x80)) { 408 len = __fex_parse_sse(uap, &inst); 409 if (len == 0) 410 goto not_ieee; 411 412 /* disable all traps and clear flags */ 413 __fenv_getcwsw(&oldcwsw); 414 cwsw = (oldcwsw & ~0x3f) | 0x003f0000; 415 __fenv_setcwsw(&cwsw); 416 __fenv_getmxcsr(&oldmxcsr); 417 mxcsr = (oldmxcsr & ~0x3f) | 0x1f80; | 361 case (unsigned long)SIG_DFL: 362 /* simulate trap with no handler installed */ 363 sigaction(SIGFPE, &act, NULL); 364 kill(getpid(), SIGFPE); 365 break; 366 #if !defined(__lint) 367 case (unsigned long)SIG_IGN: 368 break; 369 #endif 370 default: 371 act.sa_handler(sig, sip, uap); 372 } 373 } 374 375 #elif defined(__x86) 376 377 #if defined(__amd64) 378 #define test_sse_hw 1 379 #else 380 extern int _sse_hw; 381 #define test_sse_hw _sse_hw 382 #endif 383 384 #if !defined(REG_PC) 385 #define REG_PC EIP 386 #endif 387 388 /* 389 * If a handling mode is in effect, apply it; otherwise invoke the 390 * saved handler 391 */ 392 static void 393 __fex_hdlr(int sig, siginfo_t *sip, ucontext_t *uap) 394 { 395 struct fex_handler_data *thr_handlers; 396 struct sigaction act; 397 void (*handler)() = NULL, (*simd_handler[4])(); 398 int mode, simd_mode[4], i, len, accrued, *ap; 399 unsigned int cwsw, oldcwsw, mxcsr, oldmxcsr; 400 enum fex_exception e, simd_e[4]; 401 fex_info_t info, simd_info[4]; 402 unsigned long addr; 403 siginfo_t osip = *sip; 404 sseinst_t inst; 405 406 /* check for an exception caused by an SSE instruction */ 407 if (!(uap->uc_mcontext.fpregs.fp_reg_set.fpchip_state.status & 0x80)) { 408 len = __fex_parse_sse(uap, &inst); 409 if (len == 0) 410 goto not_ieee; 411 412 /* disable all traps and clear flags */ 413 __fenv_getcwsw(&oldcwsw); 414 cwsw = (oldcwsw & ~0x3f) | 0x003f0000; 415 __fenv_setcwsw(&cwsw); 416 __fenv_getmxcsr(&oldmxcsr); 417 mxcsr = (oldmxcsr & ~0x3f) | 0x1f80; |