master
E. Almqvist 3 years ago
parent 41bfd1f899
commit aa71984ae0
  1. 13
      kernel/idt.c
  2. 12
      kernel/isr.asm
  3. 3
      lib/conv.c

@ -24,9 +24,18 @@ void exception_handler() {
char* buf; char* buf;
print("[exc] ", EXC_COLOR); print("[exc] ", EXC_COLOR);
buf = itoa(debug, buf, 10); buf = itoa(debug, buf, 10);
println(buf, 0x0c); print(buf, 0x0c);
if( debug == 13 ) { // General Protection Fault
uint* eip_ptr = 0xe223;
uint eip = *eip_ptr;
buf = itoa(eip, buf, 16);
print(" ptr: ", EXC_COLOR);
print(buf, 0x0e);
}
new_line();
__asm__ __volatile__("cli; hlt"); __asm__ __volatile__("cli; hlt");
} }

@ -1,8 +1,18 @@
isr_debug_ptr equ 0xe222 isr_debug_ptr equ 0xe222
isr_eip_ptr equ 0xe223
%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
; Save the instruction pointer
push eax
;mov eax, eip
mov [isr_eip_ptr], dword eax
pop eax
; Handle the exception
call exception_handler call exception_handler
iret iret
%endmacro %endmacro
@ -24,7 +34,7 @@ isr_no_err_stub 4
isr_no_err_stub 5 isr_no_err_stub 5
isr_no_err_stub 6 isr_no_err_stub 6
isr_no_err_stub 7 isr_no_err_stub 7
isr_no_err_stub 8 ; err isr_err_stub 8 ; err
isr_no_err_stub 9 isr_no_err_stub 9
isr_err_stub 10 isr_err_stub 10
isr_err_stub 11 isr_err_stub 11

@ -22,9 +22,6 @@ char* itoa( int value, char * str, int base ) {
*ptr++ = '-'; *ptr++ = '-';
} }
// if(value < 0 && base == 10 ) // sign
// *ptr++ = '-';
// Remember where the numbers start. // Remember where the numbers start.
low = ptr; low = ptr;

Loading…
Cancel
Save