Skip to content

Commit

Permalink
avoid interrupt handler recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4452852 committed Aug 29, 2013
1 parent e63aa2d commit 3316df8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion boot/isr.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "interrupt.h"

.section .data
recursion_flag: .long 0
.section .text
.globl interrupt_handler_start
interrupt_handler_start:
Expand All @@ -17,11 +18,21 @@ i = i + 1
.endr

exception_handler:
cmpl $2, %ss:recursion_flag
je hlt_loop
incl %ss:recursion_flag

# 0(sp): irq number
# 4(sp): error code
# 8(sp): eip
# 12(sp): cs
# 16(sp): eflag
call interrupt_handler
addl $8, %esp # skip irq number and error code

decl %ss:recursion_flag
iret

hlt_loop:
hlt
jmp hlt_loop

0 comments on commit 3316df8

Please sign in to comment.