User Guide
x87 Floating-Point Programming 247
24592—Rev. 3.15—November 2009 AMD64 Technology
setting all the registers to full, and thus they may affect execution of subsequent x87 floating-point
instructions. For details, see “Mixing Media Code with x87 Code” on page 233.
6.2.5 Pointers and Opcode State
The x87 instruction pointer, instruction opcode, and data pointer are part of the x87 environment (non-
data processor state) that is loaded and stored by the instructions described in “x87 Environment” on
page 248. Figure 6-6 illustrates the pointer and opcode state. Execution of all x87 instructions—except
control instructions (see “Control” on page 273)—causes the processor to store this state in hardware.
For convenience, the pointer and opcode state is illustrated here as registers. However, the manner of
storing this state in hardware depends on the hardware implementation. The AMD64 architecture
specifies only the software-visible state that is saved in memory. (See “Media and x87 Processor State”
in Volume 2 for details of the memory images.)
Figure 6-6. x87 Pointers and Opcode State
Last x87 Instruction Pointer. The contents of the 64-bit last-instruction pointer depends on the
operating mode, as follows:
• 64-Bit Mode—The pointer contains the 64-bit RIP offset of the last non-control x87 instruction
executed (see “Control” on page 273 for a definition of control instructions). The 16-bit code-
segment (CS) selector is not saved. (It is the operating system’s responsibility to ensure that the 64-
bit state-restoration is executed in the same code segment as the preceding 64-bit state-store.)
• Legacy Protected Mode and Compatibility Mode—The pointer contains the 16-bit code-segment
(CS) selector and the 16-bit or 32-bit eIP of the last non-control x87 instruction executed.
• Legacy Real Mode and Virtual-8086 Mode—The pointer contains the 20-bit or 32-bit linear
address (CS base + eIP) of the last non-control x87 instruction executed.
The FINIT and FNINIT instructions clear all bits in this pointer.
Last x87 Opcode. The 11-bit instruction opcode holds a permutation of the two-byte instruction
opcode from the last non-control x87 floating-point instruction executed by the processor. The opcode
field is formed as follows:
• Opcode Field[10:8] = First x87-opcode byte[2:0].
513-138.eps
63
010
Instruction Pointer (rIP)
Data Pointer
Opcode