mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:58:11 +00:00
Kernel: Set up an initial boot framebuffer console
Instead of seeing a black screen until GraphicsManagement was fully initialized, this allows us to see the console output much earlier. So, if the bootloader provided us with a framebuffer, set up a console as early as possible.
This commit is contained in:
parent
eb446725d5
commit
24f2f3ba4e
5 changed files with 121 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <Kernel/Devices/ConsoleDevice.h>
|
||||
#include <Kernel/Devices/DeviceManagement.h>
|
||||
#include <Kernel/Devices/PCISerialDevice.h>
|
||||
#include <Kernel/Graphics/Console/BootFramebufferConsole.h>
|
||||
#include <Kernel/Graphics/GraphicsManagement.h>
|
||||
#include <Kernel/Locking/Spinlock.h>
|
||||
#include <Kernel/TTY/ConsoleManagement.h>
|
||||
|
@ -18,6 +19,10 @@
|
|||
|
||||
#include <LibC/stdarg.h>
|
||||
|
||||
namespace Kernel {
|
||||
extern Atomic<Graphics::BootFramebufferConsole*> boot_framebuffer_console;
|
||||
}
|
||||
|
||||
static bool serial_debug;
|
||||
// A recursive spinlock allows us to keep writing in the case where a
|
||||
// page fault happens in the middle of a dbgln(), etc
|
||||
|
@ -75,6 +80,8 @@ 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()) {
|
||||
boot_console->write(ch, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,6 +99,8 @@ 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()) {
|
||||
boot_console->write(ch, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue