aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/isa
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-07-21 21:52:48 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-07-21 21:52:48 +0000
commit1e39a4bceec953c71ea2ee4b75b58b3bc4d71809 (patch)
tree89398484d43bb1d8807fbfb9a8af354b9eb3e298 /sys/i386/isa
parentdad46c55946982c97e8eb0560d01f9b703e736cf (diff)
downloadsrc-1e39a4bceec953c71ea2ee4b75b58b3bc4d71809.tar.gz
src-1e39a4bceec953c71ea2ee4b75b58b3bc4d71809.zip
MFCamd64 r238598:
Provide siginfo.si_code for floating point errors when error occurs using the SSE math processor. MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=238678
Diffstat (limited to 'sys/i386/isa')
-rw-r--r--sys/i386/isa/npx.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index 4e61ad2be311..69413ff0e0d9 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -600,12 +600,13 @@ static char fpetable[128] = {
* For XMM traps, the exceptions were never cleared.
*/
int
-npxtrap()
+npxtrap_x87(void)
{
u_short control, status;
if (!hw_float) {
- printf("npxtrap: fpcurthread = %p, curthread = %p, hw_float = %d\n",
+ printf(
+ "npxtrap_x87: fpcurthread = %p, curthread = %p, hw_float = %d\n",
PCPU_GET(fpcurthread), curthread, hw_float);
panic("npxtrap from nowhere");
}
@@ -627,6 +628,28 @@ npxtrap()
return (fpetable[status & ((~control & 0x3f) | 0x40)]);
}
+#ifdef CPU_ENABLE_SSE
+int
+npxtrap_sse(void)
+{
+ u_int mxcsr;
+
+ if (!hw_float) {
+ printf(
+ "npxtrap_sse: fpcurthread = %p, curthread = %p, hw_float = %d\n",
+ PCPU_GET(fpcurthread), curthread, hw_float);
+ panic("npxtrap from nowhere");
+ }
+ critical_enter();
+ if (PCPU_GET(fpcurthread) != curthread)
+ mxcsr = curthread->td_pcb->pcb_save->sv_xmm.sv_env.en_mxcsr;
+ else
+ stmxcsr(&mxcsr);
+ critical_exit();
+ return (fpetable[(mxcsr & (~mxcsr >> 7)) & 0x3f]);
+}
+#endif
+
/*
* Implement device not available (DNA) exception
*