From 472b715eebaa4ff45fed1b5c4cae4168b134719f Mon Sep 17 00:00:00 2001 From: tholo Date: Sat, 8 Feb 1997 23:36:58 +0000 Subject: [PATCH] Provide more information on FP exceptions --- sys/arch/i386/isa/npx.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index 683332aeb9a..37d8d28a0ee 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,3 +1,4 @@ +/* $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 @@ -439,16 +440,28 @@ npxintr(arg) * 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: -- 2.20.1