update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
2 changed files with 40 additions and 5 deletions
Showing only changes of commit 39be6ab099 - Show all commits

View File

@ -6,6 +6,10 @@
#include <kernel/Terminal/TTY.h>
#include <kernel/Timer/Timer.h>
#include <ctype.h>
extern TerminalDriver* g_terminal_driver;
namespace Debug
{
@ -64,6 +68,35 @@ namespace Debug
return Kernel::Serial::putchar_any(ch);
if (Kernel::TTY::is_initialized())
return Kernel::TTY::putchar_current(ch);
if (g_terminal_driver)
{
static uint32_t col = 0;
static uint32_t row = 0;
if (ch == '\n')
{
row++;
col = 0;
}
else if (ch == '\r')
{
col = 0;
}
else
{
if (!isprint(ch))
ch = '?';
g_terminal_driver->putchar_at(ch, col, row, TerminalColor::BRIGHT_WHITE, TerminalColor::BLACK);
col++;
if (col >= g_terminal_driver->width())
{
row++;
col = 0;
}
}
}
}
void print_prefix(const char* file, int line)

View File

@ -82,6 +82,8 @@ static void parse_command_line()
extern "C" uint8_t g_userspace_start[];
extern "C" uint8_t g_userspace_end[];
TerminalDriver* g_terminal_driver = nullptr;
static void init2(void*);
extern "C" void kernel_main()
@ -114,6 +116,10 @@ extern "C" void kernel_main()
PageTable::initialize();
dprintln("PageTable initialized");
g_terminal_driver = VesaTerminalDriver::create();
ASSERT(g_terminal_driver);
dprintln("VESA initialized");
Heap::initialize();
dprintln("Heap initialzed");
@ -141,11 +147,7 @@ extern "C" void kernel_main()
dprintln("Serial devices initialized");
}
TerminalDriver* terminal_driver = VesaTerminalDriver::create();
ASSERT(terminal_driver);
dprintln("VESA initialized");
auto vtty = MUST(VirtualTTY::create(terminal_driver));
auto vtty = MUST(VirtualTTY::create(g_terminal_driver));
dprintln("Virtual TTY initialized");
MUST(Scheduler::initialize());