void setfsr(ulong v) { ulong vv; vv = (getfsr() & ~FPFSR) | (v & FPFSR); asm(" ld [%fp-4], %fsr"); }
static void trapFPE(int signo) { char buf[64]; USED(signo); snprint(buf, sizeof(buf), "sys: fp: exception status=%.4lux", getfsr()); disfault(nil, buf); }
static void trapFPE(int signo, siginfo_t *si, void *a) { char buf[64]; USED(signo); USED(a); snprint(buf, sizeof(buf), "sys: fp: exception status=%.4lux pc=%#p", getfsr(), si->si_addr); disfault(nil, buf); }
ulong getFPstatus(void) { ulong fsr = 0, fsr9 = getfsr(); /* on specific machines, could be table lookup */ if(fsr9&FPAINEX) fsr |= INEX; if(fsr9&FPAOVFL) fsr |= OVFL; if(fsr9&FPAUNFL) fsr |= UNFL; if(fsr9&FPAZDIV) fsr |= ZDIV; if(fsr9&FPAINVAL) fsr |= INVAL; return fsr; }