From 4e817cecfa7328af34fb96db7f052352737cd07e Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Wed, 16 Oct 2024 20:41:17 +0200 Subject: kernel: Add RSOD(red screen of death) This is not useful since 99% of the time I will have access to the serial output. But it does look cool. --- kernel/cpu/idt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'kernel/cpu') diff --git a/kernel/cpu/idt.c b/kernel/cpu/idt.c index a7a93f6..474727f 100644 --- a/kernel/cpu/idt.c +++ b/kernel/cpu/idt.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,14 @@ __attribute__((no_caller_saved_registers)) void EOI(u8 irq) { } void general_protection_fault(reg_t *regs) { + int is_userspace = (regs->error_code & (1 << 2)); + if (is_userspace) { + signal_process(current_task, SIGSEGV); + return; + } + + log_enable_screen(); + klog(LOG_ERROR, "General Protetion Fault"); kprintf(" Error Code: %x\n", regs->error_code); kprintf("Instruction Pointer: %x\n", regs->eip); @@ -90,6 +99,8 @@ void page_fault(reg_t *regs) { return; } + log_enable_screen(); + klog(LOG_ERROR, "Page Fault"); kprintf("CR2: %x\n", cr2); if (current_task) { -- cgit v1.2.3