Intel 80286, 80287 manual Mov

Models: 80287 80286

1 515
Download 515 pages 45.04 Kb
Page 443
Image 443

PROGRAMMING NUMERIC APPLICATIONS

F 1ST P

 

Is

updated before FMUL Is executed

FMUL

 

MOV

AX,I

Is

now safe to use

Figure 2-10. Documenting Data Synchronization

This Is an ASM286 code macro to redefine the FIST Instruction to prevent any concurrency

while the Instruction runs. A walt Instruction Is placed Immediately after the escape to ensure the store Is done

before the pr09ram may continue.

;

CodeMacro FIST memop: Mw

RflxM 111B, memop

ModRM 010B, memop

RWf I x

EndM

FIgure 2-11. Nonconcurrent FIST InstructIon Code Macro

As an alternative to the NPX default fix-up of numeric errors, the 80286 CPU can be notified whenever an exception occurs. The CPU can then implement any sort of recovery procedures desired, for any numeric error detectable by the NPX. When a numeric error is unmasked and the error occurs, the NPX stops further execution of the numeric instruction and signals this event to the CPU. On the next occurrence of an ESC or WAIT instruction, the CPU traps to a software excep· tion handler. Some ESC instructions do not check for errors. These are the nonwaited forms FNINIT, FNSTENV, FNSAVE, FNSTSW, FNSTCW, and FNCLEX.

When the NPX signals an unmasked exception condition, it is requesting help. The fact that the error was unmasked indicates that further numeric program execution under the arithmetic and program· ming rules of the NPX is unreasonable.

If concurrent execution is allowed, the state of the CPU when it recognizes the exception is undefined. The CPU may have changed many of its internal registers and be executing a totally different program by the time the exception occurs. To handle this situation, the NPX has special registers updated at the start of each numeric instruction to describe the state of the numeric program when the failed instruction was attempted.

Error synchronization ensures that the NPX is in a well·defined state after an unmasked numeric error occurs. Without a well-defined state, it would be impossible for exception recovery routines to figure out why the numeric error occurred, or to recover successfully from the error.

2-51

Page 443
Image 443
Intel 80286, 80287 manual Mov