Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture

6-18 Vol. 1
PROCEDURE CALLS, INTERRUPTS, AND EXCEPTIONS
interrupt table contains instruction pointers to the interrupt and exception handler
procedures.
The processor saves the state of the EFLAGS register, the EIP register, the CS
register, and an optional error code on the stack before switching to the handler
procedure.
A return from the interrupt or exception handler is carried out with the IRET
instruction.
See Chapter 15, “8086 Emulation,” in the Intel® 64 and IA-32 Architectures Soft-
ware Developer’s Manual, Volume 3A, for more information on handling interrupts
and exceptions in real-address mode.
6.4.4 INT n, INTO, INT 3, and BOUND Instructions
The INT n, INTO, INT 3, and BOUND instructions allow a program or task to explicitly
call an interrupt or exception handler. The INT n instruction uses an interrupt vector
as an argument, which allows a program to call any interrupt handler.
The INTO instruction explicitly calls the overflow exception (#OF) handler if the over-
flow flag (OF) in the EFLAGS register is set. The OF flag indicates overflow on arith-
metic instructions, but it does not automatically raise an overflow exception. An
overflow exception can only be raised explicitly in either of the following ways:
Execute the INTO instruction.
Test the OF flag and execute the INT n instruction with an argument of 4 (the
vector number of the overflow exception) if the flag is set.
Both the methods of dealing with overflow conditions allow a program to test for
overflow at specific places in the instruction stream.
The INT 3 instruction explicitly calls the breakpoint exception (#BP) handler.
The BOUND instruction explicitly calls the BOUND-range exceeded exception (#BR)
handler if an operand is found to be not within predefined boundaries in memory. This
instruction is provided for checking references to arrays and other data structures.
Like the overflow exception, the BOUND-range exceeded exception can only be raised
explicitly with the BOUND instruction or the INT n instruction with an argument of 5
(the vector number of the bounds-check exception). The processor does not implicitly
perform bounds checks and raise the BOUND-range exceeded exception.
6.4.5 Handling Floating-Point Exceptions
When operating on individual or packed floating-point values, the IA-32 architecture
supports a set of six floating-point exceptions. These exceptions can be generated
during operations performed by the x87 FPU instructions or by SSE/SSE2/SSE3
instructions. When an x87 FPU instruction (including the FISTTP instruction in SSE3)
generates one or more of these exceptions, it in turn generates floating-point error