Kernel: Make TTY a class

This commit is contained in:
Bananymous
2022-12-23 15:55:45 +02:00
parent 3f7a61a4d2
commit d8fd6afd12
11 changed files with 408 additions and 405 deletions

View File

@@ -7,7 +7,7 @@
#include <kernel/RTC.h>
#include <kernel/Shell.h>
#include <kernel/Serial.h>
#include <kernel/tty.h>
#include <kernel/TTY.h>
namespace Kernel
{
@@ -32,6 +32,11 @@ namespace Kernel
kprint("\e[32muser\e[m# ");
}
void Shell::SetTTY(TTY* tty)
{
m_tty = tty;
}
void Shell::Run()
{
PrintPrompt();
@@ -78,8 +83,8 @@ namespace Kernel
kprintln("'clear' does not support command line arguments");
return;
}
TTY::clear();
TTY::set_cursor_pos(0, 0);
m_tty->Clear();
m_tty->SetCursorPos(0, 0);
return;
}

View File

@@ -14,7 +14,7 @@
#include <kernel/RTC.h>
#include <kernel/Serial.h>
#include <kernel/Shell.h>
#include <kernel/tty.h>
#include <kernel/TTY.h>
#include <kernel/VESA.h>
#define DISABLE_INTERRUPTS() asm volatile("cli")
@@ -52,16 +52,14 @@ extern "C" void kernel_main(multiboot_info_t* mbi, uint32_t magic)
s_multiboot_info = mbi;
if (!VESA::PreInitialize())
if (!VESA::Initialize())
{
dprintln("Could not initialize VESA");
return;
}
TTY::initialize();
kmalloc_initialize();
VESA::Initialize();
TTY* tty1 = new TTY;
ParsedCommandLine cmdline;
if (mbi->flags & 0x02)
@@ -80,7 +78,7 @@ extern "C" void kernel_main(multiboot_info_t* mbi, uint32_t magic)
kprintln("Hello from the kernel!");
auto& shell = Kernel::Shell::Get();
shell.SetTTY(tty1);
shell.Run();
for (;;)