Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
Vol. 1 7-31
PROGRAMMING WITH GENERAL-PURPOSE INSTRUCTIONS
segment registers (DS, ES, FS, GS, and SS). The transfers are always made to or
from a segment register and a general-purpose register or memory. Transfers
between segment registers are not supported.
The POP and MOV instructions cannot place a value in the CS register. Only the far
control-transfer versions of the JMP, CALL, and RET instructions (see Section
7.3.16.2, “Far Control Transfer Instructions”) affect the CS register directly.
7.3.16.2 Far Control Transfer Instructions
The JMP and CALL instructions (see Section 7.3.8, “Control Transfer Instructions”)
both accept a far pointer as a source operand to transfer program control to a
segment other than the segment currently being pointed to by the CS register. When
a far call is made with the CALL instruction, the current values of the EIP and CS
registers are both pushed on the stack.
The RET instruction (see “Call and return instructions” on page 7-21) can be used to
execute a far return. Here, program control is transferred from a code segment that
contains a called procedure back to the code segment that contained the calling
procedure. The RET instruction restores the values of the CS and EIP registers for the
calling procedure from the stack.
7.3.16.3 Software Interrupt Instructions
The software interrupt instructions INT, INTO, BOUND, and IRET (see Section
7.3.8.4, “Software Interrupt Instructions”) can also call and return from interrupt
and exception handler procedures that are located in a code segment other than the
current code segment. With these instructions, however, the switching of code
segments is handled transparently from the application program.
7.3.16.4 Load Far Pointer Instructions
The load far pointer instructions LDS (load far pointer using DS), LES (load far
pointer using ES), LFS (load far pointer using FS), LGS (load far pointer using GS),
and LSS (load far pointer using SS) load a far pointer from memory into a segment
register and a general-purpose general register. The segment selector part of the far
pointer is loaded into the selected segment register and the offset is loaded into the
selected general-purpose register.
7.3.17 Miscellaneous Instructions
The following instructions perform operations that are of interest to applications
programmers. For the purpose of this discussion, these instructions are further
divided into subordinate subgroups of instructions that provide for:
• Address computations
• Table lookup