master
E. Almqvist 3 years ago
parent b45ed4263f
commit d3e8ff9d1c
  1. 3
      kernel/idt.c
  2. 13
      kernel/isr.asm
  3. 2
      kernel/kernel.c

@ -21,14 +21,13 @@ void exception_handler() {
uint* irq_ptr = 0xe222; uint* irq_ptr = 0xe222;
uint8 irq = *irq_ptr; uint8 irq = *irq_ptr;
pic_send_eoi(irq);
char* buf; char* buf;
print("[exc] ", EXC_COLOR); print("[exc] ", EXC_COLOR);
buf = itoa(irq, buf, 10); buf = itoa(irq, buf, 10);
print(buf, 0x0c); print(buf, 0x0c);
new_line(); new_line();
pic_send_eoi(irq);
} }
void idt_set_desc(uint8 idx, void* isr, uint8 flags) { void idt_set_desc(uint8 idx, void* isr, uint8 flags) {

@ -2,22 +2,25 @@ isr_debug_ptr equ 0xe222
%macro isr_err_stub 1 %macro isr_err_stub 1
isr_stub_%+%1: isr_stub_%+%1:
; Save exception vec
mov [isr_debug_ptr], byte %1 mov [isr_debug_ptr], byte %1
pusha
; Handle the exception
call exception_handler call exception_handler
sti
cli cli
hlt ;hlt
iret popa
iret
%endmacro %endmacro
%macro isr_no_err_stub 1 %macro isr_no_err_stub 1
isr_stub_%+%1: isr_stub_%+%1:
mov [isr_debug_ptr], byte %1 mov [isr_debug_ptr], byte %1
pusha
call exception_handler call exception_handler
sti
cli cli
;hlt ;hlt
popa
iret iret
%endmacro %endmacro

@ -66,6 +66,7 @@ void kernel_init() {
clear_screen(); clear_screen();
print_kernel_motd(); print_kernel_motd();
/*
print_kernel_stats(); print_kernel_stats();
char* buf; char* buf;
@ -78,6 +79,7 @@ void kernel_init() {
printalign(buf, 0x0f, MIDDLE); printalign(buf, 0x0f, MIDDLE);
++i; ++i;
} }
*/
while(true) { __asm__("hlt"); } // never escape this function while(true) { __asm__("hlt"); } // never escape this function
} }

Loading…
Cancel
Save