+/* $OpenBSD: npx.c,v 1.13 1997/02/08 23:36:58 tholo Exp $ */
/* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */
#if 0
* just before it is used).
*/
p->p_md.md_regs = (struct trapframe *)&frame->if_es;
-#ifdef notyet
+
/*
* Encode the appropriate code for detailed information on
* this exception.
*/
- code = XXX_ENCODE(addr->sv_ex_sw);
-#else
- code = 0; /* XXX */
+ if (addr->sv_ex_sw & EN_SW_IE)
+ code = FPE_FLTINV;
+#ifdef notyet
+ else if (addr->sv_ex_sw & EN_SW_DE)
+ code = FPE_FLTDEN;
#endif
- trapsignal(p, SIGFPE, code, 0, 0); /* XXX type? */
+ else if (addr->sv_ex_sw & EN_SW_ZE)
+ code = FPE_FLTDIV;
+ else if (addr->sv_ex_sw & EN_SW_OE)
+ code = FPE_FLTOVF;
+ else if (addr->sv_ex_sw & EN_SW_UE)
+ code = FPE_FLTUND;
+ else if (addr->sv_ex_sw & EN_SW_PE)
+ code = FPE_FLTRES;
+ else
+ code = 0; /* XXX unknown */
+ trapsignal(p, SIGFPE, T_ARITHTRAP, code, frame->if_eip);
} else {
/*
* Nested interrupt. These losers occur when: