aboutsummaryrefslogtreecommitdiff
path: root/src/idt
diff options
context:
space:
mode:
Diffstat (limited to 'src/idt')
-rw-r--r--src/idt/interrupthandler.cc3
-rw-r--r--src/idt/stubs.S20
2 files changed, 19 insertions, 4 deletions
diff --git a/src/idt/interrupthandler.cc b/src/idt/interrupthandler.cc
index 7af830b..7524f19 100644
--- a/src/idt/interrupthandler.cc
+++ b/src/idt/interrupthandler.cc
@@ -9,6 +9,7 @@ InterruptHandler::~InterruptHandler() {
IDT::uninstall(m_irq, this);
}
-void InterruptHandler::trigger() {
+cpu_state_t* InterruptHandler::trigger(cpu_state_t* cpu) {
printk("Unhandled interrupt ", uhex{m_irq}, '\n');
+ return cpu;
}
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 */