User's Manual

12-4 Vol. 3
INTEL
®
MMX
TECHNOLOGY SYSTEM PROGRAMMING
12.3 SAVING AND RESTORING THE MMX STATE AND
REGISTERS
Because the MMX registers are aliased to the x87 FPU data registers, the MMX state
can be saved to memory and restored from memory as follows:
Execute an FSAVE, FNSAVE, or FXSAVE instruction to save the MMX state to
memory. (The FXSAVE instruction also saves the state of the XMM and MXCSR
registers.)
Execute an FRSTOR or FXRSTOR instruction to restore the MMX state from
memory. (The FXRSTOR instruction also restores the state of the XMM and
MXCSR registers.)
The save and restore methods described above are required for operating systems
(see
Section 12.4, “Saving MMX State on Task or Context Switches”). Applications
can in some cases save and restore only the MMX registers in the following way:
Table 12-3. Effect of the MMX, x87 FPU, and FXSAVE/FXRSTOR Instructions on the
x87 FPU Tag Word
Instruction
Type
Instruction x87 FPU Tag Word Image of x87 FPU Tag Word
Stored in Memory
MMX All (except EMMS) All tags are set to 00B (valid). Not affected.
MMX EMMS All tags are set to 11B
(empty).
Not affected.
x87 FPU All (except FSAVE,
FSTENV, FRSTOR,
FLDENV)
Tag for modified floating-
point register is set to 00B or
11B.
Not affected.
x87 FPU and
FXSAVE
FSAVE, FSTENV,
FXSAVE
Tags and register values are
read and interpreted; then all
tags are set to 11B.
Tags are set according to the
actual values in the floating-
point registers; that is, empty
registers are marked 11B and
valid registers are marked
00B (nonzero), 01B (zero), or
10B (special).
x87 FPU and
FXRSTOR
FRSTOR, FLDENV,
FXRSTOR
All tags marked 11B in
memory are set to 11B; all
other tags are set according
to the value in the
corresponding floating-point
register: 00B (nonzero), 01B
(zero), or 10B (special).
Tags are read and
interpreted, but not modified.