Exceptions

From OSDev.wiki
Revision as of 14:02, 27 October 2008 by osdev>Virtlink
Jump to navigation Jump to search

Exceptions as described in this article are generated by the CPU when an 'error' occurs. Some exceptions are not really errors in most cases, such as page faults.

Exceptions are classified as:

  • Faults: These can be corrected and the program may continue as if nothing happend.
  • Traps: Traps are reported immediately after the execution of the trapping instruction.
  • Aborts: Some severe unrecoverable error.
Name Vector nr. Type Mnemonic Error code?
Divide-by-zero Error 0 Fault #DE No
Debug 1 Fault/Trap #DB No
Non-maskable Interrupt 2 Interrupt #NMI No
Breakpoint 3 Trap #BP No
Overflow 4 Trap #OF No
Bound Range Exceeded 5 Fault #BR No
Invalid Opcode 6 Fault #UD No
Device Not Available 7 Fault #NM No
Double Fault 8 Abort #NM Yes
Coprocessor Segment Overrun 9 Fault - No
Invalid TSS 10 Fault #TS Yes
Segment Not Present 11 Fault #NP Yes
Stack-Segment Fault 12 Fault #SS Yes
General Protection Fault 13 Fault #SS Yes
Page Fault 14 Fault #SS Yes
Reserved 15 - - No
x87 Floating-Point Exception 16 Fault #MF No
Alignment Check 17 Fault #AC Yes
Machine Check 18 Abort #MC No
SIMD Floating-Point Exception 19 Fault #XM/#XF No
Reserved 20-29 - - No
Security Exception 30 - #SX No
Reserved 31 - - No

Faults

Divide-by-zero Error

The Divide-by-zero Error occurs when dividing any number by 0 using the DIV or IDIV instruction. Many OS developers use this exception to test whether their exception handling code works. This exception may also occur when the result is too large to be represented in the destination.

The Instruction Pointer points to the instruction which caused the exception.

Bound Range Exceeded

Invalid Opcode

Device Not Available

Invalid TSS

Segment Not Present

Stack-Segment Fault

General Protection Fault

Page Fault

x87 Floating-Point Exception

Alignment Check

SIMD Floating-Point Exception

Traps

Debug

This page is a stub.
You can help the wiki by accurately adding more contents to it.

Breakpoint

Overflow

Aborts

Double Fault

Machine Check

Misc

Non-maskable Interrupt