1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

Kernel: Instantiate a TextModeConsole early on if there's no framebuffer

If the bootloader that loaded us is providing a framebuffer details from
the Multiboot protocol then we can instantiate a framebuffer console.
Otherwise, we should use a text mode console, assuming that the BIOS and
the bootloader didn't try to modeset the screen resolution so we have is
a VGA 80x25 text mode being displayed on screen.

Since "boot_framebuffer_console" is no longer a good representative as a
global variable name, it's changed to g_boot_console to match the fact
that it can be assigned with a text mode console and not framebuffer
console if needed.
This commit is contained in:
Liav A 2022-02-09 21:09:41 +02:00 committed by Linus Groh
parent 278b0aa629
commit c6c3e2a7fd
3 changed files with 14 additions and 9 deletions

View file

@ -20,7 +20,7 @@
#include <LibC/stdarg.h>
namespace Kernel {
extern Atomic<Graphics::BootFramebufferConsole*> boot_framebuffer_console;
extern Atomic<Graphics::Console*> g_boot_console;
}
static bool serial_debug;
@ -80,7 +80,7 @@ static void critical_console_out(char ch)
// especially when we want to avoid any memory allocations...
if (GraphicsManagement::is_initialized() && GraphicsManagement::the().console()) {
GraphicsManagement::the().console()->write(ch, true);
} else if (auto* boot_console = boot_framebuffer_console.load()) {
} else if (auto* boot_console = g_boot_console.load()) {
boot_console->write(ch, true);
}
}
@ -99,7 +99,7 @@ static void console_out(char ch)
}
if (ConsoleManagement::is_initialized()) {
ConsoleManagement::the().debug_tty()->emit_char(ch);
} else if (auto* boot_console = boot_framebuffer_console.load()) {
} else if (auto* boot_console = g_boot_console.load()) {
boot_console->write(ch, true);
}
}