diff options
-rw-r--r-- | arch/i386/boot/idt.c | 22 | ||||
-rw-r--r-- | arch/i386/kernel/serial.c | 5 | ||||
-rw-r--r-- | include/kernel/serial.h | 8 |
3 files changed, 15 insertions, 20 deletions
diff --git a/arch/i386/boot/idt.c b/arch/i386/boot/idt.c index 0789a17..bd27542 100644 --- a/arch/i386/boot/idt.c +++ b/arch/i386/boot/idt.c @@ -1,4 +1,4 @@ -#include "syscall.h" +#include <kernel/syscall.h> #include <kernel/isr.h> #include <kernel/io.h> #include <kernel/pic.h> @@ -66,24 +66,17 @@ char *exceptions[] = { __attribute__((noreturn)) void halt_catch_fire(struct isr_frame *frame) { - kprintf("Registers at interrupt:\n"); - kprintf("\tEAX = %x\n", frame->eax); - kprintf("\tEBX = %x\n", frame->ebx); - kprintf("\tECX = %x\n", frame->ecx); - kprintf("\tEDX = %x\n", frame->edx); - kprintf("\tESI = %x\n", frame->esi); - kprintf("\tEDI = %x\n", frame->edi); - kprintf("\tESP = %x\n", frame->esp); - kprintf("\tEBP = %x\n", frame->ebp); - kprintf("\tEIP = %x\n", frame->eip); - kprintf("\tEFLAGS = %x\n", frame->eflags); - kprintf("Current code selector: %d\n", frame->cs); + dump_reg(frame); __asm__ volatile("cli;hlt"); } __attribute__((noreturn)) void exception_handler(struct isr_frame *frame) { switch (frame->vector) { + case 0x0E: + kprintf("PAGE FAULT\n"); + halt_catch_fire(frame); + break; default: kprintf("Unhandled exception: %s\n", exceptions[frame->vector]); halt_catch_fire(frame); @@ -159,7 +152,8 @@ void idt_install(void) { idt_set_gate(128, syscall_stub, 0x08, IDT_INTERRUPT); - register_syscall(halt_catch_fire, 0); + register_syscall(sys_stop, 0); + register_syscall(sys_status, 1); __asm__ volatile("lidt %0" : : "memory"(idtr)); __asm__ volatile("sti"); diff --git a/arch/i386/kernel/serial.c b/arch/i386/kernel/serial.c index 58163cb..5bd4105 100644 --- a/arch/i386/kernel/serial.c +++ b/arch/i386/kernel/serial.c @@ -40,8 +40,3 @@ void write_serial(char a) { while (is_transmit_empty() == 0); outb(PORT, a); } - -void serial_writestring(const char *str) { - for (size_t i = 0; i < strlen(str); i++) - write_serial(str[i]); -} diff --git a/include/kernel/serial.h b/include/kernel/serial.h index a815766..23f6907 100644 --- a/include/kernel/serial.h +++ b/include/kernel/serial.h @@ -1,9 +1,15 @@ #ifndef SERIAL_H #define SERIAL_H +#include <kernel/string.h> + int serial_init(void); char read_serial(void); void write_serial(char a); -void serial_writestring(const char *str); + +inline void serial_writestring(const char *str) { + for (size_t i = 0; i < strlen(str); i++) + write_serial(str[i]); +} #endif |