diff options
author | kib <kib@FreeBSD.org> | 2012-07-21 21:52:48 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2012-07-21 21:52:48 +0000 |
commit | 85d13cee2c898c09c66d9363ed996ec22e463477 (patch) | |
tree | 89398484d43bb1d8807fbfb9a8af354b9eb3e298 /sys/i386/isa/npx.c | |
parent | 7925edc16eae8c1b2933c3bb83e9005b8c8f18fa (diff) | |
download | FreeBSD-src-85d13cee2c898c09c66d9363ed996ec22e463477.zip FreeBSD-src-85d13cee2c898c09c66d9363ed996ec22e463477.tar.gz |
MFCamd64 r238598:
Provide siginfo.si_code for floating point errors when error occurs
using the SSE math processor.
MFC after: 3 weeks
Diffstat (limited to 'sys/i386/isa/npx.c')
-rw-r--r-- | sys/i386/isa/npx.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 4e61ad2..69413ff 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 * |