PROGRAMMING NUMERIC APPLICATIONS

FRSTOR source

FRSTOR (restore state) reloads the 80287 from the 94-byte memory area defined by the source operand. This information should have been written by a previous FSAVEjFNSAVE instruction and not altered by any other instruction. An FWAIT is not required after FRSTOR. FRSTOR will automatically wait and check for interrupts until all data transfers are completed before continuing to the next instruction.

Note that the 80287 "reacts" to its new state at the conclusion of the FRSTOR; it will, for example, generate an exception request if the exception and mask bits in the memory image so indicate when the next WAIT or error-checking-ESC instruction is executed.

FSTENVIFNSTENV destination

FSTENVjFNSTENV (store environment) writes the 80287's basic status-control, status, and tag words, and exception pointers-to the memory location defined by the destination operand. Typically, the environment is saved on the CPU stack. FSTENVjFNSTENV is often used by exception handlers because it provides access to the exception pointers that identify the offending instruction and operand. After saving the environment, FSTENV/FNSTENV sets all exception masks in the processor. FSTENV checks for pending errors before executing, FNSTENV does not.

Figure 2-2 shows the format of the environment data in memory. FNSTENV does not store the environment until all NPX activity has completed. Thus, the data saved by the instruction reflects the 80287 after any previously decoded instruction has been executed. After writing the environment image to memory, FNSTENVjFSTENV initializes the 80287 state as if FNINITjFINIT had been executed.

 

 

 

 

MEMORY

 

MEMORY OFFSET

 

 

 

 

OFFSET

 

15

 

 

 

15

 

 

 

 

 

 

 

CONTROL WORD

+0

CONTROL WORD

+0

 

STATUS WORD

+2

STATUS WORD

+2

 

TAG WORD

+4

TAG WORD

+4

 

INSTRUCTION POINTER (15-0)

+6

IPOFFSET

+6

 

INSTRUCTION1)1

I

INSTRUCTION

+6

CSSELECTOR

+8

POINTER (19-16)

0

OPCODE (10-0)

 

 

 

 

DATA POINTER (15-0)

+10

DATA OPERAND OFFSET

+10

DATA POINTER I

0

+12

DATA OPERAND SELECTOR

+12

 

(19-16)

 

 

 

 

 

15

1211

 

 

 

 

 

REAL MODE

 

PROTECTED MODE

 

G30108

Figure 2-2. FSTENVIFLDENV Memory Layout

2-19

Page 411
Image 411
Intel 80286, 80287 manual Fstenvifldenv Memory Layout