mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-27 15:04:33 +00:00
Add "screen" command to panic UI
This commit is contained in:
parent
455c8a82de
commit
72ee2075ae
@ -45,6 +45,8 @@ extern void DisplayStackSmashing();
|
||||
extern void DisplayBufferOverflow();
|
||||
|
||||
Video::Font *CrashFont = nullptr;
|
||||
void *FbBeforePanic = nullptr;
|
||||
size_t FbPagesBeforePanic = 0;
|
||||
|
||||
nsa void __printfWrapper(char c, void *)
|
||||
{
|
||||
@ -101,9 +103,19 @@ nsa void HaltAllCores()
|
||||
|
||||
nsa void InitFont()
|
||||
{
|
||||
/* Hope we won't crash here */
|
||||
|
||||
if (FbBeforePanic != nullptr)
|
||||
KernelAllocator.FreePages(FbBeforePanic, FbPagesBeforePanic);
|
||||
else
|
||||
{
|
||||
FbPagesBeforePanic = TO_PAGES(Display->GetSize);
|
||||
FbBeforePanic = KernelAllocator.RequestPages(FbPagesBeforePanic);
|
||||
memcpy(FbBeforePanic, Display->GetBuffer, Display->GetSize);
|
||||
}
|
||||
|
||||
if (CrashFont == nullptr)
|
||||
{
|
||||
/* Hope we won't crash here */
|
||||
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);
|
||||
|
@ -40,10 +40,12 @@
|
||||
#include "keyboard.hpp"
|
||||
|
||||
extern void ExPrint(const char *Format, ...);
|
||||
extern Video::Font *CrashFont;
|
||||
extern void DiagnosticDataCollection();
|
||||
extern void InitFont();
|
||||
|
||||
extern Video::Font *CrashFont;
|
||||
extern void *FbBeforePanic;
|
||||
|
||||
struct StackFrame
|
||||
{
|
||||
struct StackFrame *bp;
|
||||
@ -789,6 +791,7 @@ nsa void UserInput(char *Input)
|
||||
ExPrint("\eCACACA mem - Display memory information.\n");
|
||||
ExPrint("\eAAAAAA dump [addr] [len] - Dump [len] bytes from [addr].\n");
|
||||
ExPrint("\eCACACA diag - Collect diagnostic information.\n");
|
||||
ExPrint("\eAAAAAA screen - Display the final output prior to system panic.\n");
|
||||
}
|
||||
else if (strcmp(Input, "clear") == 0)
|
||||
{
|
||||
@ -918,6 +921,17 @@ nsa void UserInput(char *Input)
|
||||
{
|
||||
DiagnosticDataCollection();
|
||||
}
|
||||
else if (strcmp(Input, "screen") == 0)
|
||||
{
|
||||
if (unlikely(FbBeforePanic == nullptr))
|
||||
{
|
||||
ExPrint("\eFF0000No screen data available\n");
|
||||
goto End;
|
||||
}
|
||||
memcpy(Display->GetBuffer, FbBeforePanic, Display->GetSize);
|
||||
Display->UpdateBuffer();
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else if (strcmp(Input, "pt") == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user