Fix a race in the FP copy code. If we setup our temporary FP save area
authorMatthew Dillon <dillon@dragonflybsd.org>
Fri, 30 Apr 2004 02:59:14 +0000 (02:59 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Fri, 30 Apr 2004 02:59:14 +0000 (02:59 +0000)
commit330938c0c30562e59daa800948980938efae39ea
treee2eae4cfdc6c26b58325c893b23686539cb5e625
parentbd331ffea93c654f1f90b01334d2e16f1bcfce5a
Fix a race in the FP copy code.  If we setup our temporary FP save area
before we check npxthread it is possible for a one-instruction-window
interrupt to come along and save the application FP state to our temporary
area and then clear npxthread, causing the application FP state to be thrown
away.

Also, if there is no app FP state (npxthread is NULL), it is possible
once we set npxthread=curthread for an interrupt to come along and save
bogus FP state to our temporary save area before we have a chance to
fninit (one instruction window since we clts just prior to the fninit),
causing the fninit to fault and npxdna to restore the bogus state.

Use a critical section to prevent these cases from occuring.
sys/i386/i386/bcopy.s
sys/platform/pc32/i386/bcopy.s