Saturday 3 August 2013

Common Exceptions and Interrupt Numbers - Using .trap

You may notice within call stacks, some traps occur as a result of a certain exception, using the .trap command with the address of the the trap frame specified within the call stack, you may notice a small segment from the output called Error Code = # The number associated with the predefined interrupt number within the IDT. You can use the !idt extension to view the IDT.

There are 19 different interrupt numbers for 32-bit operating systems:

0 = Divide Error

This is usually when a instruction has attempted to divide data by zero. This is caused by device drivers.

1 = Debug (Single Step)

This is a debugging feature used by compilers, each line of code is reviewed for any errors, and then line before and after the line of code can be checked to see how the error occurred. 

2 = Non-Maskable Interrupt (NMI)

A very high priority interrupt, and usually indicates a unrecoverable hardware error.

3 = Breakpoint

Another debugging feature, breakpoints can inserted into code, when a breakpoint is reached, it pauses the program to allow the programmer to check for any errors, and examine the current state of the program.

4 = Overflow 

Buffer Overflow is when the device driver has overwritten it's allocated buffer.

Stack Overflow is when a  program has made too many calls, running outside of the call stack.

5 = Bounds Check 

Checking that a array or variable is within the correct allocated range, and doesn't overrun this boundary (device drivers or programs).

6 = Invalid Opcode

Invalid operation code, a invalid assembly or machine code instruction was called.

7 = NPX Not Available

8 = Double Fault

A exception has occurred while processing and handling a another exception.  

9 = NPX Segement Overrun

10 = Invalid TSS (Task State Segment)

11 = Segment Not Present

12 = Stack Fault

13 = General Protection Fault

Covers several different exceptions, I would view the call stack for more information.

14 = Page Fault

A device driver accesses a page which is not available within physical memory. The Memory Manager makes the page available. This is a exception when a invalid memory address has been referenced.

15 = Intel Reserved

16 = Floating Point 

17 = Alignment Check

18 = Machine Check

The CPU has found a hardware error and has raised the exception.   

19 = SIMD Floating Point


No comments:

Post a Comment