Exceptions: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(New page: '''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. Exc...)
 
No edit summary
Line 1: Line 1:
{| align="right"
| __TOC__
|}

'''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 Fault|page faults]].
'''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 Fault|page faults]].


Line 38: Line 42:
|-
|-
! [[#Overflow|Overflow]]
! [[#Overflow|Overflow]]
| 3
| 4
| Trap
| Trap
| #OF
| #OF
| No
|-
! [[#Bound Range Exceeded|Bound Range Exceeded]]
| 5
| Fault
| #BR
| No
|-
! [[#Invalid Opcode|Invalid Opcode]]
| 6
| Fault
| #UD
| No
|-
! [[#Device Not Available|Device Not Available]]
| 7
| Fault
| #NM
| No
|-
! [[#Double Fault|Double Fault]]
| 8
| Abort
| #NM
| Yes
|-
! Coprocessor Segment Overrun
| 9
| Fault
| -
| No
|-
! [[#Invalid TSS|Invalid TSS]]
| 10
| Fault
| #TS
| Yes
|-
! [[#Segment Not Present|Segment Not Present]]
| 11
| Fault
| #NP
| Yes
|-
! [[#Stack-Segment Fault|Stack-Segment Fault]]
| 12
| Fault
| #SS
| Yes
|-
! [[#General Protection Fault|General Protection Fault]]
| 13
| Fault
| #SS
| Yes
|-
! [[#Page Fault|Page Fault]]
| 14
| Fault
| #SS
| Yes
|-
! Reserved
| 15
| -
| -
| No
|-
! [[#x87 Floating-Point Exception|x87 Floating-Point Exception]]
| 16
| Fault
| #MF
| No
|-
! [[#Alignment Check|Alignment Check]]
| 17
| Fault
| #AC
| Yes
|-
! [[#Machine Check|Machine Check]]
| 18
| Abort
| #MC
| No
|-
! [[#SIMD Floating-Point Exception|SIMD Floating-Point Exception]]
| 19
| Fault
| #XM/#XF
| No
|-
! Reserved
| 20-29
| -
| -
| No
|-
! [[#Security Exception|Security Exception]]
| 30
| -
| #SX
| No
|-
! Reserved
| 31
| -
| -
| No
| No
|}
|}
Line 47: Line 159:


=== Divide-by-zero Error ===
=== 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 ===
=== Debug ===
{{stub}}
=== Non-maskable Interrupt ===
=== Breakpoint ===
=== Breakpoint ===
=== Overflow ===
=== Overflow ===

== Aborts ==
=== Double Fault ===
=== Machine Check ===


== Misc ==
=== Non-maskable Interrupt ===

Revision as of 14:02, 27 October 2008

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