From d3e8ff9d1cf57f1c672b0b37e28e7e91fc680858 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Tue, 19 Apr 2022 15:27:03 +0200 Subject: [PATCH] EIP? --- kernel/idt.c | 3 +-- kernel/isr.asm | 13 ++++++++----- kernel/kernel.c | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/kernel/idt.c b/kernel/idt.c index 18a4920..f2ed57f 100644 --- a/kernel/idt.c +++ b/kernel/idt.c @@ -21,14 +21,13 @@ void exception_handler() { uint* irq_ptr = 0xe222; uint8 irq = *irq_ptr; + pic_send_eoi(irq); char* buf; - print("[exc] ", EXC_COLOR); buf = itoa(irq, buf, 10); print(buf, 0x0c); new_line(); - pic_send_eoi(irq); } void idt_set_desc(uint8 idx, void* isr, uint8 flags) { diff --git a/kernel/isr.asm b/kernel/isr.asm index 35e40fa..39d4c96 100644 --- a/kernel/isr.asm +++ b/kernel/isr.asm @@ -2,22 +2,25 @@ isr_debug_ptr equ 0xe222 %macro isr_err_stub 1 isr_stub_%+%1: - ; Save exception vec mov [isr_debug_ptr], byte %1 - - ; Handle the exception + pusha call exception_handler + sti cli - hlt - iret + ;hlt + popa + iret %endmacro %macro isr_no_err_stub 1 isr_stub_%+%1: mov [isr_debug_ptr], byte %1 + pusha call exception_handler + sti cli ;hlt + popa iret %endmacro diff --git a/kernel/kernel.c b/kernel/kernel.c index 3585165..fdda082 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -66,6 +66,7 @@ void kernel_init() { clear_screen(); print_kernel_motd(); + /* print_kernel_stats(); char* buf; @@ -78,6 +79,7 @@ void kernel_init() { printalign(buf, 0x0f, MIDDLE); ++i; } + */ while(true) { __asm__("hlt"); } // never escape this function }