diff --git a/drivers/vga.c b/drivers/vga.c index 64a80f6..a309682 100644 --- a/drivers/vga.c +++ b/drivers/vga.c @@ -75,8 +75,8 @@ void new_line() { } void println(char* str, int attribute_byte) { - if( cursor_row > MAX_ROWS ) { - set_cursor_pos(0, MAX_ROWS); + if( cursor_row >= MAX_ROWS ) { + set_cursor_pos(0, 0); println(str, attribute_byte); return; } @@ -84,15 +84,6 @@ void println(char* str, int attribute_byte) { new_line(); } -void printint(int i, int attribute_byte) { - /* - char* strbuf; - - strbuf = int_to_str(i, strbuf); - println(strbuf, attribute_byte); - */ -} - void printalign(char* str, int attribute_byte, enum align alignment) { uint strlenbuf = strlen(str); diff --git a/drivers/vga.h b/drivers/vga.h index cfa90e6..e9a1f62 100644 --- a/drivers/vga.h +++ b/drivers/vga.h @@ -21,6 +21,5 @@ void set_cursor_pos(); void print(); void println(); void new_line(); -void printint(int i, int attribute_byte); void printalign(char* str, int attribute_byte, enum align alignment); void vga_init(); diff --git a/kernel/idt.c b/kernel/idt.c index a9bc235..18a4920 100644 --- a/kernel/idt.c +++ b/kernel/idt.c @@ -18,17 +18,17 @@ static idt_entry IDT[IDT_MAX_DESCS]; static idtr IDTR; void exception_handler() { - uint* debug_ptr = 0xe222; - uint8 debug = *debug_ptr; + uint* irq_ptr = 0xe222; + uint8 irq = *irq_ptr; char* buf; print("[exc] ", EXC_COLOR); - buf = itoa(debug, buf, 10); + buf = itoa(irq, buf, 10); print(buf, 0x0c); new_line(); - __asm__ __volatile__("cli; hlt"); + pic_send_eoi(irq); } void idt_set_desc(uint8 idx, void* isr, uint8 flags) { diff --git a/kernel/idt.h b/kernel/idt.h index 34cddf6..df1e639 100644 --- a/kernel/idt.h +++ b/kernel/idt.h @@ -1,4 +1,5 @@ #include "../lib/types.h" +#include "pic.h" #define IDT_MAX_DESCS 256 #define EXC_COLOR 0x08 diff --git a/kernel/isr.asm b/kernel/isr.asm index d6a5b6a..35e40fa 100644 --- a/kernel/isr.asm +++ b/kernel/isr.asm @@ -7,6 +7,8 @@ isr_stub_%+%1: ; Handle the exception call exception_handler + cli + hlt iret %endmacro @@ -14,13 +16,15 @@ isr_stub_%+%1: isr_stub_%+%1: mov [isr_debug_ptr], byte %1 call exception_handler + cli + ;hlt iret %endmacro extern exception_handler isr_no_err_stub 0 ; TODO: make keeb drivers -isr_err_stub 1 ; keyboard : noerr +isr_err_stub 1 isr_no_err_stub 2 isr_no_err_stub 3 isr_no_err_stub 4 @@ -28,7 +32,7 @@ isr_no_err_stub 5 isr_no_err_stub 6 isr_no_err_stub 7 isr_err_stub 8 ; err -isr_no_err_stub 9 +isr_no_err_stub 9 ; keyboard? isr_err_stub 10 isr_err_stub 11 isr_err_stub 12