diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 4725c3bf52..6764b6e611 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -720,14 +720,14 @@ void Process::sys$sigreturn() ASSERT_NOT_REACHED(); } -void Process::crash() +void Process::crash(int signal) { ASSERT_INTERRUPTS_DISABLED(); ASSERT(!is_dead()); dump_backtrace(); - m_termination_signal = SIGSEGV; + m_termination_signal = signal; dump_regions(); ASSERT(is_ring3()); die(); diff --git a/Kernel/Process.h b/Kernel/Process.h index ff3d4e5e5c..328cb3a788 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -13,6 +13,7 @@ #include #include #include +#include class ELFLoader; class FileDescriptor; @@ -191,7 +192,7 @@ public: static void initialize(); - [[noreturn]] void crash(); + [[noreturn]] void crash(int signal = SIGSEGV); [[nodiscard]] static int reap(Process&); const TTY* tty() const { return m_tty; } diff --git a/Kernel/i386.cpp b/Kernel/i386.cpp index 1409da2c43..2a660cf55a 100644 --- a/Kernel/i386.cpp +++ b/Kernel/i386.cpp @@ -167,19 +167,22 @@ void exception_6_handler(RegisterDump& regs) kprintf("#UD with !current\n"); hang(); } - kprintf("%s invalid opcode: %u(%s)\n", current->process().is_ring0() ? "Kernel" : "Process", current->pid(), current->process().name().characters()); + + kprintf("%s Illegal instruction: %s(%u)\n", + current->process().is_ring0() ? "Kernel" : "Process", + current->process().name().characters(), + current->pid() + ); dump(regs); - dump_backtrace(); if (current->process().is_ring0()) { kprintf("Oh shit, we've crashed in ring 0 :(\n"); hang(); } - hang(); - current->process().crash(); + current->process().crash(SIGILL); } // 7: FPU not available exception @@ -216,7 +219,11 @@ void exception_7_handler(RegisterDump& regs) EH_ENTRY_NO_CODE(0); void exception_0_handler(RegisterDump& regs) { - kprintf("%s DIVIDE ERROR: %u(%s)\n", current->process().is_ring0() ? "Kernel" : "User", current->pid(), current->process().name().characters()); + kprintf("%s Division by zero: %s(%u)\n", + current->process().is_ring0() ? "Kernel" : "User", + current->process().name().characters(), + current->pid() + ); dump(regs); @@ -225,7 +232,7 @@ void exception_0_handler(RegisterDump& regs) hang(); } - current->process().crash(); + current->process().crash(SIGFPE); }