Intel 64 and IA-32 Architectures Software Developers Manual Volume 3A, System Programming Guide, Part 1
Vol. 3A 5-7
INTERRUPT AND EXCEPTION HANDLING
NOTE
One exception subset normally reported as a fault is not restartable.
Such exceptions result in loss of some processor state. For example,
executing a POPAD instruction where the stack frame crosses over
the end of the stack segment causes a fault to be reported. In this
situation, the exception handler sees that the instruction pointer
(CS:EIP) has been restored as if the POPAD instruction had not been
executed. However, internal processor state (the general-purpose
registers) will have been modified. Such cases are considered
programming errors. An application causing this class of exceptions
should be terminated by the operating system.
5.6 PROGRAM OR TASK RESTART
To allow the restarting of program or task following the handling of an exception or
an interrupt, all exceptions (except aborts) are guaranteed to report exceptions on
an instruction boundary. All interrupts are guaranteed to be taken on an instruction
boundary.
For fault-class exceptions, the return instruction pointer (saved when the processor
generates an exception) points to the faulting instruction. So, when a program or
task is restarted following the handling of a fault, the faulting instruction is restarted
(re-executed). Restarting the faulting instruction is commonly used to handle
exceptions that are generated when access to an operand is blocked. The most
common example of this type of fault is a page-fault exception (#PF) that occurs
when a program or task references an operand located on a page that is not in
memory. When a page-fault exception occurs, the exception handler can load the
page into memory and resume execution of the program or task by restarting the
faulting instruction. To insure that the restart is handled transparently to the
currently executing program or task, the processor saves the necessary registers
and stack pointers to allow a restart to the state prior to the execution of the faulting
instruction.
For trap-class exceptions, the return instruction pointer points to the instruction
following the trapping instruction. If a trap is detected during an instruction which
transfers execution, the return instruction pointer reflects the transfer. For example,
if a trap is detected while executing a JMP instruction, the return instruction pointer
points to the destination of the JMP instruction, not to the next address past the JMP
instruction. All trap exceptions allow program or task restart with no loss of conti-
nuity. For example, the overflow exception is a trap exception. Here, the return
instruction pointer points to the instruction following the INTO instruction that tested
EFLAGS.OF (overflow) flag. The trap handler for this exception resolves the overflow
condition. Upon return from the trap handler, program or task execution continues at
the instruction following the INTO instruction.
The abort-class exceptions do not support reliable restarting of the program or task.
Abort handlers are designed to collect diagnostic information about the state of the