A floating point fault (instead of DNA fault) can occur when the TS bit
authorMatthew Dillon <dillon@dragonflybsd.org>
Sun, 2 Apr 2006 20:43:27 +0000 (20:43 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sun, 2 Apr 2006 20:43:27 +0000 (20:43 +0000)
commit0f963623e37ccaec438a724def1636ced3b34c84
treef7cb9c1e885826acacda7c163283fa794d55be6f
parent98768033f21ec43d6a54338fd24c4ad0ecec9cc5
A floating point fault (instead of DNA fault) can occur when the TS bit
in CR0 is clear and will call npx_intr().  However, because we are using
a trap exception vector this fault does not disable interrupts and it is
possible for a preemption to come along after the fault is dispatched
before but npx_intr() has time to do anything.  This preemption can wind
up changing the FP state, causing npx_intr() to hit an assertion and panic
the machine.

Keep using the interrupt-enabled version of the vector (SDT_SYS386TGT
instead of SDT_SYS386IGT), but adjust npx_intr() to enter a critical
section to avoid getting the FP state ripped out from under it, then have
it check for the race case and call npxdna() as appropriate.  Document the
whole mess.

Reported-by: Sascha Wildner <saw@online.de>
Found-with: sysutils/crashme using crashme +2000 666 100 1:00:00 5
sys/i386/isa/npx.c
sys/platform/pc32/isa/npx.c