This preview shows page 1. Sign up to view the full content.
Unformatted text preview: s x87 FPU instruction and is unmasked causes the processor to freeze immediately when encountering the next WAIT or x87 FPU instruction (except for no-wait instructions). This means that if the x87 FPU exception handler has not already been invoked due to the earlier exception (and therefore, the handler not has cleared that exception state from the x87 FPU), the processor is forced to wait for the handler to be invoked and handle the exception, before the processor can execute another WAIT or x87 FPU instruction. As explained in Section D.2.1.3, "No-Wait x87 FPU Instructions Can Get x87 FPU Interrupt in Window," if a no-wait instruction is used outside of the x87 FPU exception handler, in the Intel486 and Pentium processors, it may accept an unmasked exception from a previous x87 FPU instruction which happens to fall within the external interrupt sampling window that is opened near the beginning of execution of all x87 FPU instructions. This will not happen in the P6 family and Pentium 4 processors, because this sampling window has been removed from the no-wait group of x87 FPU instructions. D.3 RECOMMENDED PROTOCOL FOR MS-DOS* COMPATIBILITY HANDLERS The activities of numeric programs can be split into two major areas: program control and arithmetic. The program control part performs activities such as deciding what functions to perform, calculating addresses of numeric operands, and loop control. The arithmetic part simply adds, subtracts, multiplies, and performs other operations on the numeric operands. The processor is designed to handle these two parts separately and efficiently. An x87 FPU exception handler, if a system chooses to implement one, is often one of the most complicated parts of the program control code. Vol. 1 D-11 GUIDELINES FOR WRITING X87 FPU EXCEPTION HANDLERS D.3.1 Floating-Point Exceptions and Their Defaults The x87 FPU can recognize six classes of floating-point exception conditions while executing floating-point instructions: 1. #I -- Invalid operation #IS -- Stack fault #IA -- IEEE standard invalid operation 2. #Z -- Divide-by-zero 3. #D -- Denormalized operand 4. #O -- Numeric overflow 5. #U -- Numeric underflow 6. #P -- Inexact result (precision) For complete details on these exceptions and their defaults, see Section 8.4, "x87 FPU Floating-Point Exception Handling," and Section 8.5, "x87 FPU Floating-Point Exception Conditions." D.3.2 Two Options for Handling Numeric Exceptions Depending on options determined by the software system designer, the processor takes one of two possible courses of action when a numeric exception occurs: 1. The x87 FPU can handle selected exceptions itself, producing a default fix-up that is reasonable in most situations. This allows the numeric program execution to continue undisturbed. Programs can mask individual exception types to indicate that the x87 FPU should generate this safe, reasonable result whenever the exception occurs. The default exception fix-up a...
View Full Document
- Winter '11