Kernel: Better error reporting from VESA and fix texmode rendering

This commit is contained in:
Bananymous 2023-01-05 03:36:20 +02:00
parent d6623def32
commit 086f0c7cf6
2 changed files with 6 additions and 6 deletions

View File

@ -85,7 +85,10 @@ namespace VESA
bool Initialize() bool Initialize()
{ {
if (!(s_multiboot_info->flags & MULTIBOOT_FLAGS_FRAMEBUFFER)) if (!(s_multiboot_info->flags & MULTIBOOT_FLAGS_FRAMEBUFFER))
{
derrorln("bootloader did not provide a memory map");
return false; return false;
}
auto& framebuffer = s_multiboot_info->framebuffer; auto& framebuffer = s_multiboot_info->framebuffer;
s_addr = framebuffer.addr; s_addr = framebuffer.addr;
@ -101,7 +104,7 @@ namespace VESA
{ {
if (s_bpp != 24 && s_bpp != 32) if (s_bpp != 24 && s_bpp != 32)
{ {
dprintln("Unsupported bpp {}", s_bpp); derrorln("Unsupported bpp {}", s_bpp);
return false; return false;
} }
@ -123,7 +126,7 @@ namespace VESA
} }
else else
{ {
dprintln("Unsupported type for VESA framebuffer"); derrorln("Unsupported type for VESA framebuffer");
return false; return false;
} }
@ -291,7 +294,7 @@ namespace VESA
static void TextPutCharAt(uint16_t ch, uint32_t x, uint32_t y, Color fg, Color bg) static void TextPutCharAt(uint16_t ch, uint32_t x, uint32_t y, Color fg, Color bg)
{ {
uint32_t index = y * s_pitch + x; uint32_t index = y * s_width + x;
((uint16_t*)s_addr)[index] = TextEntry(ch, TextColor(fg, bg)); ((uint16_t*)s_addr)[index] = TextEntry(ch, TextColor(fg, bg));
} }

View File

@ -67,10 +67,7 @@ extern "C" void kernel_main(multiboot_info_t* mbi, uint32_t magic)
s_multiboot_info = mbi; s_multiboot_info = mbi;
if (!VESA::Initialize()) if (!VESA::Initialize())
{
dprintln("Could not initialize VESA");
return; return;
}
ParsedCommandLine cmdline; ParsedCommandLine cmdline;
if (mbi->flags & 0x02) if (mbi->flags & 0x02)