Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src/sys/arch/amd64/amd64

Module Name:    src
Committed By:   dsl
Date:           Sun Feb  9 22:19:02 UTC 2014

Modified Files:
        src/sys/arch/amd64/amd64: fpu.c

Log Message:
Simplify fputrap() considerably.
There is no need to save the fpu state here, and definitely no need
  to initialise the fpu.
The code is running with interrupts disabled having trapped on either
  an x87 instruction (the one after the one that generated the error)
  or on an SSE (etc) instruction that caused the error.
So all it needs to do it obtain the 'error' bits from the relevant
  status register, clear the bits, and then raise any signal.
The signal code will save the fp state if the signal itself isn't masked.
It also passes the FP state to the signal handler - which can modify it.
(I suspect that wasn't thecase when this code was written.)
Seems to work for both 64bit and 32bit 'divide by zero' errors.
For the xmm trap, the xmm registers are updated for the result of the
  instruction, but the trap returns to re-execute the instruction!
This makes it difficult for the signal handler to do anything sensible.

I've also changed the code to only use unmasked error bits when deciding
the signal code.

To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/amd64/amd64/fpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Home | Main Index | Thread Index | Old Index