Give Kernel a console object
This commit is contained in:
parent
7f72106639
commit
522e788ebd
3 changed files with 27 additions and 6 deletions
|
@ -31,11 +31,28 @@ Kernel::systemKernel()
|
||||||
* Public
|
* Public
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Kernel::Kernel()
|
||||||
|
: mConsole()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Kernel::initialize()
|
||||||
|
{
|
||||||
|
mConsole.clear(kernel::Console::Color::Blue);
|
||||||
|
mConsole.printString("Loading Polka...\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Kernel::panic(const char* msg,
|
Kernel::panic(const char* msg,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
|
mConsole.clear(Console::Color::Magenta);
|
||||||
|
mConsole.printString("PANIC! PANIC! PANIC! :-(\n");
|
||||||
|
mConsole.printString(msg);
|
||||||
|
// TODO: Dump registers.
|
||||||
|
halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#define __KERNEL_HH__
|
#define __KERNEL_HH__
|
||||||
|
|
||||||
#include "Attributes.hh"
|
#include "Attributes.hh"
|
||||||
|
#include "Console.hh"
|
||||||
|
|
||||||
|
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
|
@ -18,9 +19,16 @@ struct Kernel
|
||||||
{
|
{
|
||||||
static Kernel& systemKernel();
|
static Kernel& systemKernel();
|
||||||
|
|
||||||
|
Kernel();
|
||||||
|
|
||||||
|
void initialize();
|
||||||
|
|
||||||
void panic(const char* msg, ...);
|
void panic(const char* msg, ...);
|
||||||
|
|
||||||
void halt() NORETURN;
|
void halt() NORETURN;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Console mConsole;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace kernel */
|
} /* namespace kernel */
|
||||||
|
|
|
@ -44,11 +44,7 @@ kmain(multiboot::Information *information)
|
||||||
multiboot::Information::setInformation(information);
|
multiboot::Information::setInformation(information);
|
||||||
auto info = multiboot::Information::information();
|
auto info = multiboot::Information::information();
|
||||||
|
|
||||||
// Reinitialize the system console now that we have global static objects.
|
kernel::Kernel::systemKernel().initialize();
|
||||||
auto& console = kernel::Console::systemConsole();
|
|
||||||
console.clear(kernel::Console::Color::Blue);
|
|
||||||
|
|
||||||
console.printString("Loading Polka ...\n");
|
|
||||||
|
|
||||||
console.printFormat("Command line: \"%s\"\n", info->commandLine());
|
console.printFormat("Command line: \"%s\"\n", info->commandLine());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue