
Chapter 3: General-Purpose Programming
105
24593—Rev. 3.09—September 2003
AMD 64-Bit Technology
storing them in the IDT. “Exceptions and Interrupts” in
Volume 2 contains detailed information on the interrupt
mechanism and the requirements on system software for
managing the mechanism.
The IDT is indexed using the interrupt number, or
vector
. How
the vector is specified depends on the source, as described
below. The first 32 of the available 256 interrupt vectors are
reserved for internal use by the processor—for exceptions (as
described below) and other purposes.
Interrupts are caused either by software or hardware. The INT,
INT3, and INTO instructions implement a
software interrupt
by
calling an interrupt handler directly. These are general-purpose
(privilege-level-3) instructions. The operand of the INT
instruction is an immediate byte value specifying the interrupt
vector used to index the IDT. INT3 and INTO are specific forms
of software interrupts used to call interrupt 3 and interrupt 4,
respectively.
External interrupts
are produced by system logic
which passes the IDT index to the processor via input signals.
External interrupts can be either
maskable
or
non-maskable
.
Exceptions
usually occur as a result of software execution errors
or other internal-processor errors. Exceptions can also occur in
non-error situations, such as debug-program single-stepping or
address-breakpoint detection. In the case of exceptions, the
processor produces the IDT index based on the detected
condition. The handlers for interrupts and exceptions are
identical for a given vector.
The processor’s response to an exception depends on the type of
the exception. For all exceptions except 128-bit-media and x87
floating-point exceptions, control automatically transfers to the
handler (or service routine) for that exception, as defined by
the exceptions vector. For 128-bit-media and x87 floating-point
exceptions, there is both a masked and unmasked response.
When unmasked, these exceptions invoke their exception
handler. When masked, a default masked response is provided
instead of invoking the exception handler.
Exceptions and software-initiated interrupts occur
synchronously with respect to the processor clock. There are
three types of exceptions:
Faults
—A fault is a precise exception that is reported on the
boundary before the interrupted instruction. Generally,