Add Kernel object
- Implement halt() - Call the system kernel halt() method at the end of kmain()
This commit is contained in:
parent
9bf27a3115
commit
abfcfd24cd
5 changed files with 86 additions and 1 deletions
54
src/Kernel.cc
Normal file
54
src/Kernel.cc
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* Kernel.cc
|
||||
* vim: set tw=80:
|
||||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
/**
|
||||
* Kernel object. This is the highest level object in the system.
|
||||
*/
|
||||
|
||||
#include "Kernel.hh"
|
||||
#include "Interrupts.hh"
|
||||
|
||||
namespace {
|
||||
|
||||
static kernel::Kernel sKernel;
|
||||
|
||||
} /* anonymous namespace */
|
||||
|
||||
namespace kernel {
|
||||
|
||||
/*
|
||||
* Static
|
||||
*/
|
||||
|
||||
Kernel*
|
||||
Kernel::systemKernel()
|
||||
{
|
||||
return &sKernel;
|
||||
}
|
||||
|
||||
/*
|
||||
* Public
|
||||
*/
|
||||
|
||||
void
|
||||
Kernel::panic(const char* msg,
|
||||
...)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Private
|
||||
*/
|
||||
|
||||
void
|
||||
Kernel::halt()
|
||||
{
|
||||
x86::InterruptHandler::systemInterruptHandler().disableInterrupts();
|
||||
for (;;) {
|
||||
asm("hlt");
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace kernel */
|
Loading…
Add table
Add a link
Reference in a new issue