Exception stuff

master
E. Almqvist 3 years ago
parent aa71984ae0
commit 901ab00dfd
  1. 2
      Makefile
  2. 2
      kernel/idt.c
  3. 4
      kernel/isr.asm
  4. 2
      kernel/kernel.c
  5. 8
      lib/conv.c

@ -10,7 +10,7 @@ LDFLAGS = -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -
# VM/Debug settings
VM = qemu-system-x86_64
VMFLAGS = -serial stdio
VMFLAGS = -serial stdio -no-reboot -no-shutdown -d int
# Do not touch these.

@ -31,7 +31,7 @@ void exception_handler() {
uint* eip_ptr = 0xe223;
uint eip = *eip_ptr;
buf = itoa(eip, buf, 16);
print(" ptr: ", EXC_COLOR);
print(" eax= ", EXC_COLOR);
print(buf, 0x0e);
}

@ -7,10 +7,8 @@ isr_stub_%+%1:
mov [isr_debug_ptr], byte %1
; Save the instruction pointer
push eax
;mov eax, eip
mov [isr_eip_ptr], dword eax
pop eax
mov [isr_eip_ptr], dword eax
; Handle the exception
call exception_handler

@ -66,7 +66,7 @@ void kernel_init() {
clear_screen();
print_kernel_motd();
//print_kernel_stats();
print_kernel_stats();
char* buf;
uint i = 0;

@ -6,7 +6,6 @@ char* itoa( int value, char * str, int base ) {
char* ptr;
char* low;
// Check for supported base.
if( base < 2 || base > 36 ) {
*str = '\0';
return str;
@ -21,21 +20,16 @@ char* itoa( int value, char * str, int base ) {
if(value < 0)
*ptr++ = '-';
}
// Remember where the numbers start.
low = ptr;
// The actual conversion.
do {
// Modulo is negative for negative value. This trick makes abs() unnecessary.
*ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz"[35 + value % base];
value /= base;
} while(value);
// Terminating the string.
*ptr-- = '\0';
// Invert the numbers.
// Invert
while ( low < ptr ) {
char tmp = *low;
*low++ = *ptr;

Loading…
Cancel
Save