Kernel: Kernel::Panic now checks that TTY is initialized instead of VESA

This commit is contained in:
Bananymous 2023-01-13 14:41:29 +02:00
parent 77e82de51e
commit 416a41745f
5 changed files with 8 additions and 10 deletions

View File

@ -26,7 +26,6 @@ namespace VESA
static uint32_t s_width = 0;
static uint32_t s_height = 0;
static uint8_t s_mode = 0;
static bool s_initialized = false;
static uint32_t s_terminal_width = 0;
static uint32_t s_terminal_height = 0;
@ -83,11 +82,6 @@ namespace VESA
return s_terminal_height;
}
bool IsInitialized()
{
return s_initialized;
}
bool Initialize()
{
if (!(g_multiboot_info->flags & MULTIBOOT_FLAGS_FRAMEBUFFER))
@ -138,7 +132,6 @@ namespace VESA
SetCursorPositionImpl(0, 0, Color::BRIGHT_WHITE);
ClearImpl(Color::BLACK);
s_initialized = true;
return true;
}

View File

@ -2,7 +2,7 @@
#include <kernel/kprint.h>
#include <kernel/Serial.h>
#include <kernel/VESA.h>
#include <kernel/TTY.h>
#define Panic(...) PanicImpl(__FILE__, __LINE__, __VA_ARGS__)
@ -13,7 +13,7 @@ namespace Kernel
__attribute__((__noreturn__))
static void PanicImpl(const char* file, int line, const char* message, Args... args)
{
if (VESA::IsInitialized())
if (TTY::IsInitialized())
{
kprint("\e[31mKernel panic at {}:{}\n", file, line);
kprint(message, args...);

View File

@ -20,6 +20,7 @@ public:
// for kprint
static void PutCharCurrent(char ch);
static bool IsInitialized();
private:
void ResetAnsiEscape();

View File

@ -26,7 +26,6 @@ namespace VESA
};
bool Initialize();
bool IsInitialized();
void PutBitmapAt(const uint8_t*, uint32_t, uint32_t, Color);
void PutBitmapAt(const uint8_t*, uint32_t, uint32_t, Color, Color);
void PutCharAt(uint16_t, uint32_t, uint32_t, Color, Color);

View File

@ -351,3 +351,8 @@ void TTY::PutCharCurrent(char ch)
ASSERT(s_tty);
s_tty->PutChar(ch);
}
bool TTY::IsInitialized()
{
return s_tty != nullptr;
}