Skip to content

Commit

Permalink
add user defined interrupt handler
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4452852 committed Aug 29, 2013
1 parent 3316df8 commit 1176ab4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boot/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "common.h"

#define IDT_MAX_EXCEPTION 32
#define IDT_MAX_DESCS (IDT_MAX_EXCEPTION)
#define IDT_MAX_DESCS 256
#define EXCEPTION_ERRCODE_MASK 0x00027d00

#ifndef __ASSEMBLY__
Expand Down
8 changes: 8 additions & 0 deletions boot/isr.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ recursion_flag: .long 0
.globl interrupt_handler_start
interrupt_handler_start:
i = 0
# intel reserve exception or fault
.rept IDT_MAX_EXCEPTION
.if (EXCEPTION_ERRCODE_MASK >> i) & 1
nop
Expand All @@ -16,6 +17,13 @@ i = 0
jmp exception_handler
i = i + 1
.endr
# user defined interrupt
.rept IDT_MAX_DESCS - IDT_MAX_EXCEPTION
pushl $0
pushl $i
jmp exception_handler
i = i + 1
.endr

exception_handler:
cmpl $2, %ss:recursion_flag
Expand Down

0 comments on commit 1176ab4

Please sign in to comment.