
104
Chapter 3: General-Purpose Programming
AMD 64-Bit Technology
24593—Rev. 3.09—September 2003
The default 64-bit operand size eliminates the need for a REX
prefix with these instructions when registers RAX–RSP (the
first set of eight GPRs) are used as operands. A REX prefix is
still required if R8–R15 (the extended set of eight GPRs) are
used as operands, because the prefix is required to address the
extended registers.
The following aspects of near branches are controlled by the
effective operand size:
Truncation of the instruction pointer.
Size of a stack pop or push, resulting from a CALL or RET.
Size of a stack-pointer increment or decrement, resulting
from a CALL or RET.
Indirect-branch operand size.
In 64-bit mode, all of the above actions are forced to 64 bits.
However, the size of the displacement field for relative
branches is still limited to 32 bits.
The operand size of near branches is fixed at 64 bits without the
need for a REX prefix. However, the address size of near
branches is not forced in 64-bit mode. Such addresses are 64 bits
by default, but they can be overridden to 32 bits by a prefix.
Branches to 64-Bit Offsets.
Because immediates are generally
limited to 32 bits, the only way a full 64-bit absolute RIP can be
specified in 64-bit mode is with an indirect branch. For this
reason, direct forms of far branches are invalid in 64-bit mode.
3.7.10
Interrupts and
Exceptions
Interrupts and exceptions are a form of control transfer
operation. They are used to call special system-service routines,
called interrupt handlers, which are designed to respond to the
interrupt or exception condition. Pointers to the interrupt
handlers are stored by the operating system in an
interrupt-
descriptor table
, or IDT. In legacy real mode, the IDT contains an
array of 4-byte far pointers to interrupt handlers. In legacy
protected mode, the IDT contains an array of 8-byte gate
descriptors. In long mode, the gate descriptors are 16 bytes.
Interrupt gates, task gates, and trap gates can be stored in the
IDT, but not call gates.
Interrupt handlers are usually privileged software because they
typically require access to restricted system resources. System
software is responsible for creating the interrupt gates and