From bd244717480d9e10dc8ad70adeadb91f5f4b132a Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Thu, 21 Mar 2024 01:57:11 +0200 Subject: [PATCH] Fix before panic framebuffer --- core/panic/handler.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/core/panic/handler.cpp b/core/panic/handler.cpp index ac6fa4f..140cf4e 100644 --- a/core/panic/handler.cpp +++ b/core/panic/handler.cpp @@ -111,21 +111,19 @@ nsa void InitFont() CPU::Stop(); } - if (FbBeforePanic != nullptr) - KernelAllocator.FreePages(FbBeforePanic, FbPagesBeforePanic); - else + if (FbBeforePanic == nullptr) { FbPagesBeforePanic = TO_PAGES(Display->GetSize); FbBeforePanic = KernelAllocator.RequestPages(FbPagesBeforePanic); - memcpy(FbBeforePanic, Display->GetBuffer, Display->GetSize); + debug("Created before panic framebuffer at %#lx", FbBeforePanic); } + memcpy(FbBeforePanic, Display->GetBuffer, Display->GetSize); - if (CrashFont == nullptr) - { - CrashFont = new Video::Font(&_binary_files_tamsyn_font_1_11_Tamsyn8x16b_psf_start, - &_binary_files_tamsyn_font_1_11_Tamsyn8x16b_psf_end, - Video::FontType::PCScreenFont2); - } + if (CrashFont) + return; + CrashFont = new Video::Font(&_binary_files_tamsyn_font_1_11_Tamsyn8x16b_psf_start, + &_binary_files_tamsyn_font_1_11_Tamsyn8x16b_psf_end, + Video::FontType::PCScreenFont2); } std::atomic UnrecoverableLock = false;