Kernel: Switch back to kernel address space on kernel panic

This commit is contained in:
apio 2022-10-18 17:13:43 +02:00
parent 92d8c9d4d5
commit 48d68a3e31

View File

@ -5,7 +5,9 @@
#include "interrupts/IDT.h"
#include "io/PIC.h"
#include "log/Log.h"
#include "memory/VMM.h"
#include "misc/MSR.h"
#include "render/Framebuffer.h"
#include "render/TextRenderer.h"
#include "std/stdio.h"
#include "thread/Scheduler.h"
@ -25,6 +27,8 @@ void dump_registers(Context* context)
[[noreturn]] void __panic_stub(Context* context)
{
VMM::switch_back_to_kernel_address_space();
VMM::apply_address_space();
if (context) dump_registers(context);
if (InitRD::is_initialized())
@ -73,6 +77,8 @@ extern "C" [[noreturn]] bool __do_int_panic(Context* context, const char* file,
TextRenderer::reset();
framebuffer0.clear(Color::Black);
if (context->number >= 0x20 && context->number < 0x30) { PIC::send_eoi((uint8_t)(context->irq_number & 0xFF)); }
Task* task;
@ -93,6 +99,8 @@ extern "C" [[noreturn]] bool __do_panic(const char* file, int line, const char*
TextRenderer::reset();
framebuffer0.clear(Color::Black);
Task* task;
if ((task = Scheduler::current_task()))
{