8-12 Vol. 1
PROGRAMMING WITH THE X87 FPU
8.1.11
Saving the x87 FPU’s State with FXSAVE
The FXSAVE and FXRSTOR instructions save and restore, respectively, the x87 FPU state along with the state of the
XMM registers and the MXCSR register. Using the FXSAVE instruction to save the x87 FPU state has two benefits:
(1) FXSAVE executes faster than FSAVE, and (2) FXSAVE saves the entire x87 FPU, MMX, and XMM state in one
operation. See Section 10.5, “FXSAVE and FXRSTOR Instructions,” for additional information about these instruc-
tions.
Figure 8-10. Real Mode x87 FPU State Image in Memory, 32-Bit Format
Figure 8-11. Protected Mode x87 FPU State Image in Memory, 16-Bit Format
Figure 8-12. Real Mode x87 FPU State Image in Memory, 16-Bit Format
0
31
0
4
8
12
16
20
24
32-Bit Real-Address Mode Format
Control Word
FDP[31:16]
FIP[31:16]
Status Word
Tag Word
FOP[10:0]
0 0 0 0 0 0 0 0 0 0 0 0
FDP[15:0]
0 0 0 0
FIP[15:0]
0 0 0 0
16
15
For instructions that also store x87 FPU data registers, the eight
80-bit registers (R0-R7) follow the above structure in sequence.
0
0
2
4
6
8
10
12
16-Bit Protected Mode Format
Control Word
15
Status Word
Tag Word
FCS
FDS
FDP
FIP
0
0
2
4
6
8
10
12
16-Bit Real-Address Mode and
Control Word
15
Status Word
Tag Word
Virtual-8086 Mode Format
0 0 0 0 0 0 0 0 0 0 0 0
Bits 10:0 of opcode
0
FIP[15:0]
FIP[19:16]
FDP[19:16]
FDP[15:0]