6 program or task restart – Intel IA-32 User Manual
Page 182
5-6 Vol. 3A
INTERRUPT AND EXCEPTION HANDLING
•
Faults — A fault is an exception that can generally be corrected and that, once corrected,
allows the program to be restarted with no loss of continuity. When a fault is reported, the
processor restores the machine state to the state prior to the beginning of execution of the
faulting instruction. The return address (saved contents of the CS and EIP registers) for the
fault handler points to the faulting instruction, rather than to the instruction following the
faulting instruction.
•
Traps — A trap is an exception that is reported immediately following the execution of the
trapping instruction. Traps allow execution of a program or task to be continued without
loss of program continuity. The return address for the trap handler points to the instruction
to be executed after the trapping instruction.
•
Aborts — An abort is an exception that does not always report the precise location of the
instruction causing the exception and does not allow a restart of the program or task that
caused the exception. Aborts are used to report severe errors, such as hardware errors and
inconsistent or illegal values in system tables.
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.