From 13ab5aef4da9ded93d7c93442911554e86ea9714 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 5 Mar 2021 16:09:03 +0200 Subject: add broken Scheduler --- src/idt/interrupthandler.cc | 3 ++- src/idt/stubs.S | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src/idt') 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 */ -- cgit v1.2.1