From fe3aab170c33ae4530f0580c52509f4c414a8769 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Tue, 22 Mar 2022 13:48:09 -0500 Subject: arch: i386: make serial_writestring inline The serial_writestring function is small enough and platform-agnostic, and therefore it should be moved into the main serial header and marked as inline. Signed-off-by: Danny Holman --- arch/i386/boot/idt.c | 22 ++++++++-------------- arch/i386/kernel/serial.c | 5 ----- 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'arch/i386') 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 #include #include #include @@ -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]); -} -- cgit v1.2.3