aboutsummaryrefslogtreecommitdiff
path: root/src/idt/stubs.S
diff options
context:
space:
mode:
Diffstat (limited to 'src/idt/stubs.S')
-rw-r--r--src/idt/stubs.S20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/idt/stubs.S b/src/idt/stubs.S
index 97f1797..4f1440d 100644
--- a/src/idt/stubs.S
+++ b/src/idt/stubs.S
@@ -2,6 +2,7 @@
.section .text
.extern handle_interrupt
+.extern handle_exception
.macro interrupt num
.global interrupt\num
@@ -16,14 +17,14 @@ interrupt\num:
exception\num:
push $0
push $\num
- jmp interrupt_common
+ jmp exception_common
.endm
.macro exception_ec num
.global exception\num
exception\num:
push $\num
- jmp interrupt_common
+ jmp exception_common
.endm
/* exceptions */
@@ -67,12 +68,25 @@ interrupt 0x0d # fpu
interrupt 0x0e # primary ATA
interrupt 0x0f # secondary ATA
+exception_common:
+ pusha
+
+ push %esp
+ call handle_exception
+ mov %eax, %esp
+
+ popa
+ /* remove error code and irq from stack */
+ add $8, %esp
+
+ iret
+
interrupt_common:
pusha
push %esp
call handle_interrupt
- mov %eax, %esp
+ add $4, %esp
popa
/* remove error code and irq from stack */