Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2]: src/sys/arch/i386/i386 Pull up following revision(s) (request...
details: https://anonhg.NetBSD.org/src/rev/72b341298fd2
branches: netbsd-2
changeset: 564084:72b341298fd2
user: riz <riz%NetBSD.org@localhost>
date: Tue Oct 11 17:14:45 2005 +0000
description:
Pull up following revision(s) (requested by christos in ticket #5923):
sys/arch/i386/i386/vector.S: revision 1.20
sys/arch/i386/i386/trap.c: revision 1.205
handle MMX faults as floating exceptions. Tested by Hauke Fath; matlab
passes all its regression suite without panicking the kernel.
diffstat:
sys/arch/i386/i386/trap.c | 48 +++++++++++++++++++++++++++++++++++++++++++-
sys/arch/i386/i386/vector.S | 6 +++-
2 files changed, 50 insertions(+), 4 deletions(-)
diffs (118 lines):
diff -r 9465f572bd63 -r 72b341298fd2 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Tue Oct 11 17:14:26 2005 +0000
+++ b/sys/arch/i386/i386/trap.c Tue Oct 11 17:14:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.200 2004/03/14 01:08:48 cl Exp $ */
+/* $NetBSD: trap.c,v 1.200.4.1 2005/10/11 17:14:45 riz Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.200 2004/03/14 01:08:48 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.200.4.1 2005/10/11 17:14:45 riz Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -126,6 +126,7 @@
#include "npx.h"
+static __inline int xmm_si_code(struct lwp *);
void trap(struct trapframe *);
void trap_tss(struct i386tss *, int, int);
#if defined(I386_CPU)
@@ -199,6 +200,45 @@
trap(&tf);
}
+static __inline int
+xmm_si_code(struct lwp *l)
+{
+ uint32_t mxcsr, mask;
+
+ if (!i386_use_fxsave) {
+#ifdef DIAGNOSTIC
+ panic("SSE FP Exception, but no SSE");
+#endif
+ return 0;
+ }
+ mxcsr = l->l_addr->u_pcb.pcb_savefpu.sv_xmm.sv_env.en_mxcsr;
+
+ /*
+ * Since we only have a single status and control register,
+ * we use the exception mask bits to mask disabled exceptions
+ */
+ mask = ~((mxcsr & __INITIAL_MXCSR__) >> 7) & 0xff;
+ switch (mask & mxcsr) {
+ case EN_SW_INVOP:
+ return FPE_FLTINV;
+ case EN_SW_DENORM:
+ case EN_SW_PRECLOSS:
+ return FPE_FLTRES;
+ case EN_SW_ZERODIV:
+ return FPE_FLTDIV;
+ case EN_SW_OVERFLOW:
+ return FPE_FLTOVF;
+ case EN_SW_UNDERFLOW:
+ return FPE_FLTUND;
+ case EN_SW_DATACHAIN:
+ return FPE_FLTSUB;
+ case 0:
+ default:
+ return 0;
+ }
+}
+
+
/*
* trap(frame):
* Exception, fault, and trap interface to BSD kernel. This
@@ -491,6 +531,7 @@
#endif
}
+ case T_XMM|T_USER:
case T_BOUND|T_USER:
case T_OFLOW|T_USER:
case T_DIVIDE|T_USER:
@@ -499,6 +540,9 @@
ksi.ksi_trap = type & ~T_USER;
ksi.ksi_addr = (void *)frame->tf_eip;
switch (type) {
+ case T_XMM|T_USER:
+ ksi.ksi_code = xmm_si_code(l);
+ break;
case T_BOUND|T_USER:
case T_OFLOW|T_USER:
ksi.ksi_code = FPE_FLTOVF;
diff -r 9465f572bd63 -r 72b341298fd2 sys/arch/i386/i386/vector.S
--- a/sys/arch/i386/i386/vector.S Tue Oct 11 17:14:26 2005 +0000
+++ b/sys/arch/i386/i386/vector.S Tue Oct 11 17:14:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.13 2004/03/11 11:39:26 yamt Exp $ */
+/* $NetBSD: vector.S,v 1.13.4.1 2005/10/11 17:14:45 riz Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -802,7 +802,9 @@
IDTVEC(trap11)
TRAP(T_ALIGNFLT)
IDTVEC(trap12)
+ ZTRAP(T_MCA)
IDTVEC(trap13)
+ ZTRAP(T_XMM)
IDTVEC(trap14)
IDTVEC(trap15)
IDTVEC(trap16)
@@ -815,7 +817,7 @@
IDTVEC(trap1d)
IDTVEC(trap1e)
IDTVEC(trap1f)
- /* 18 - 31 reserved for future exp */
+ /* 20 - 31 reserved for future exp */
ZTRAP(T_RESERVED)
IDTVEC(exceptions)
Home |
Main Index |
Thread Index |
Old Index