Instruction - Exception
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.
An example of the notation used to show an exception and error code is shown below:
- PF refers to page-fault exception
- fault code is an error code naming a type of fault (Default to zero)
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.