diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-14 09:30:31 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-14 09:36:58 +0100 |
commit | b712345c922cfd32e7ec971f817af97ca7ee7ab4 (patch) | |
tree | c8cbfe3b0e281b603cfae05f5b0abb87b53e3776 /Kernel/Arch/i386 | |
parent | c598a95b1c3b66cf1029eac2bcd88288c1fdb05f (diff) | |
download | serenity-b712345c922cfd32e7ec971f817af97ca7ee7ab4.zip |
Kernel: Use PANIC() in a bunch of places :^)
Diffstat (limited to 'Kernel/Arch/i386')
-rw-r--r-- | Kernel/Arch/i386/CPU.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 09f8f9fc06..6c4e30b139 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -43,6 +43,7 @@ #include <Kernel/Interrupts/SpuriousInterruptHandler.h> #include <Kernel/Interrupts/UnhandledInterruptHandler.h> #include <Kernel/KSyms.h> +#include <Kernel/Panic.h> #include <Kernel/Process.h> #include <Kernel/Random.h> #include <Kernel/SpinLock.h> @@ -163,8 +164,7 @@ void handle_crash(RegisterState& regs, const char* description, int signal, bool { auto process = Process::current(); if (!process) { - dmesgln("{} with !current", description); - Processor::halt(); + PANIC("{} with !current", description); } // If a process crashed while inspecting another process, @@ -175,9 +175,7 @@ void handle_crash(RegisterState& regs, const char* description, int signal, bool dump(regs); if (!(regs.cs & 3)) { - dmesgln("Crash in ring 0 :("); - dump_backtrace(); - Processor::halt(); + PANIC("Crash in ring 0"); } cli(); @@ -330,9 +328,7 @@ void debug_handler(TrapFrame* trap) auto current_thread = Thread::current(); auto& process = current_thread->process(); if ((regs.cs & 3) == 0) { - dmesgln("Debug exception in ring 0"); - Processor::halt(); - return; + PANIC("Debug exception in ring 0"); } constexpr u8 REASON_SINGLESTEP = 14; bool is_reason_singlestep = (read_dr6() & (1 << REASON_SINGLESTEP)); @@ -353,9 +349,7 @@ void breakpoint_handler(TrapFrame* trap) auto current_thread = Thread::current(); auto& process = current_thread->process(); if ((regs.cs & 3) == 0) { - dmesgln("Breakpoint trap in ring 0"); - Processor::halt(); - return; + PANIC("Breakpoint trap in ring 0"); } if (auto tracer = process.tracer()) { tracer->set_regs(regs); @@ -376,8 +370,7 @@ void breakpoint_handler(TrapFrame* trap) : "=a"(cr3)); \ asm("movl %%cr4, %%eax" \ : "=a"(cr4)); \ - dbgln("cr0={:08x} cr2={:08x} cr3={:08x} cr4={:08x}", cr0, cr2, cr3, cr4); \ - Processor::halt(); \ + PANIC("cr0={:08x} cr2={:08x} cr3={:08x} cr4={:08x}", cr0, cr2, cr3, cr4); \ } EH(2, "Unknown error") @@ -398,8 +391,7 @@ const DescriptorTablePointer& get_idtr() static void unimp_trap() { - dmesgln("Unhandled IRQ"); - Processor::Processor::halt(); + PANIC("Unhandled IRQ"); } GenericInterruptHandler& get_interrupt_handler(u8 interrupt_number) |