Port-mac68k archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: FPU Exception code
On Sun, Nov 16, 2008 at 03:59:14PM +0100, Martin Husemann wrote:
> I found this uncommited patch - I think I needed it to make
> mc68k pass all tests in src/regress/lib/libc/ieeefp/.
>
> Could somebody test this on a machine w/o fpu?
> Any reason not to commit this?
That would be hard w/o the pach...
Martin
Index: trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mac68k/mac68k/trap.c,v
retrieving revision 1.134
diff -c -u -p -r1.134 trap.c
--- trap.c 15 Oct 2008 06:51:18 -0000 1.134
+++ trap.c 16 Nov 2008 14:55:46 -0000
@@ -271,6 +271,22 @@ machine_userret(struct lwp *l, struct fr
userret(l, f, t, 0, 0);
}
+static u_int
+fpsr2siginfocode(u_int fpsr)
+{
+ if (fpsr & (1 << 10))
+ return FPE_FLTDIV;
+ if (fpsr & (1 << 11))
+ return FPE_FLTUND;
+ if (fpsr & (1 << 12))
+ return FPE_FLTOVF;
+ if (fpsr & (1 << 13))
+ return FPE_FLTINV;
+ if (fpsr & (1 << 9))
+ return FPE_FLTRES;
+ return 0;
+}
+
/*
* Trap is called from locore to handle most types of processor traps,
* including events such as simulated software interrupts/AST's.
@@ -401,17 +417,11 @@ copyfault:
*/
case T_FPERR|T_USER:
/*
- * We pass along the 68881 status register which locore
- * stashed in code for us. Note that there is a
- * possibility that the bit pattern of this register
- * will conflict with one of the FPE_* codes defined
- * in signal.h. Fortunately for us, the only such
- * codes we use are all in the range 1-7 and the low
- * 3 bits of the status register are defined as 0 so
- * there is no clash.
+ * We decode the 68881 status register which locore
+ * stashed in code for us.
*/
ksi.ksi_signo = SIGFPE;
- ksi.ksi_addr = (void *)code;
+ ksi.ksi_code = fpsr2siginfocode(code);
break;
/*
Home |
Main Index |
Thread Index |
Old Index