Make FPU exception dispatching work (more?) properly.

svn path=/trunk/; revision=57279
This commit is contained in:
Mike Nordell 2012-09-11 17:34:49 +00:00
parent 858cfa0dbb
commit e46fb748a9

View file

@ -297,28 +297,32 @@ KiNpxHandler(IN PKTRAP_FRAME TrapFrame,
} }
/* Get legal exceptions that software should handle */ /* Get legal exceptions that software should handle */
Error &= (FSW_STACK_FAULT | /* We do this by first masking off from the Mask the bits we need, */
FSW_INVALID_OPERATION | /* This is done so we can keep the FSW_STACK_FAULT bit in Error. */
FSW_DENORMAL | Mask &= (FSW_INVALID_OPERATION |
FSW_ZERO_DIVIDE | FSW_DENORMAL |
FSW_OVERFLOW | FSW_ZERO_DIVIDE |
FSW_UNDERFLOW | FSW_OVERFLOW |
FSW_PRECISION); FSW_UNDERFLOW |
FSW_PRECISION);
Error &= ~Mask; Error &= ~Mask;
if (Error & FSW_STACK_FAULT)
{
/* Issue stack check fault */
KiDispatchException2Args(STATUS_FLOAT_STACK_CHECK,
ErrorOffset,
0,
DataOffset,
TrapFrame);
}
/* Check for invalid operation */ /* Check for invalid operation */
if (Error & FSW_INVALID_OPERATION) if (Error & FSW_INVALID_OPERATION)
{ {
/* NOTE: Stack fault is handled differently than any other case. */
/* 1. It's only raised for invalid operation. */
/* 2. It's only raised if invalid operation is not masked. */
if (Error & FSW_STACK_FAULT)
{
/* Issue stack check fault */
KiDispatchException2Args(STATUS_FLOAT_STACK_CHECK,
ErrorOffset,
0,
DataOffset,
TrapFrame);
}
/* Issue fault */ /* Issue fault */
KiDispatchException1Args(STATUS_FLOAT_INVALID_OPERATION, KiDispatchException1Args(STATUS_FLOAT_INVALID_OPERATION,
ErrorOffset, ErrorOffset,