About
An exception is an event that occurs when:
- when an instruction causes an error. Example:
- an attempt to divide by zero generates an exception
- at a breakpoints
Some types of exceptions may provide error codes. An error code reports additional information about the error.
Articles Related
Notation
An example of the notation used to show an exception and error code is shown below:
#PF(fault code)
where:
- PF refers to page-fault exception
- fault code is an error code naming a type of fault (Default to zero)
Handler
When a call is made to an exception handler procedure, the processor automatically saves the state of the EFLAGS register on the procedure stack. When an exception is handled with a task switch, the state of the EFLAGS register is saved in the TSS for the task being suspended.