2016-03-23 00:33:45 -04:00
|
|
|
/* Kernel.hh
|
|
|
|
* vim: set tw=80:
|
|
|
|
* Eryn Wells <eryn@erynwells.me>
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Kernel object. This is the highest level object in the system.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KERNEL_HH__
|
|
|
|
#define __KERNEL_HH__
|
|
|
|
|
|
|
|
#include "Attributes.hh"
|
2016-03-23 00:56:00 -04:00
|
|
|
#include "Console.hh"
|
2016-03-25 01:21:49 -04:00
|
|
|
#include "Memory.hh"
|
|
|
|
#include "Multiboot.hh"
|
|
|
|
#include "kstd/Types.hh"
|
2016-03-23 00:33:45 -04:00
|
|
|
|
|
|
|
|
|
|
|
namespace kernel {
|
|
|
|
|
2016-03-25 01:25:21 -04:00
|
|
|
/** Collection of useful tidbits for setting up the system. */
|
2016-03-25 01:21:49 -04:00
|
|
|
struct StartupInformation
|
|
|
|
{
|
2016-03-25 01:25:21 -04:00
|
|
|
/** Starting address of the kernel. */
|
2016-03-25 01:21:49 -04:00
|
|
|
u32 kernelStart;
|
2016-03-25 01:25:21 -04:00
|
|
|
/** Ending address (the first address *after* the last) of the kernel. */
|
2016-03-25 01:21:49 -04:00
|
|
|
u32 kernelEnd;
|
2016-03-25 01:39:07 -04:00
|
|
|
/** Multiboot's magic value. This should be verified. */
|
|
|
|
u32 multibootMagic;
|
2016-03-25 01:25:21 -04:00
|
|
|
/** Pointer to the multiboot information struct. */
|
2016-03-25 01:21:49 -04:00
|
|
|
multiboot::Information* multibootInformation;
|
|
|
|
};
|
|
|
|
|
2016-03-25 01:25:21 -04:00
|
|
|
|
|
|
|
/** The kernel itself. */
|
2016-03-23 00:33:45 -04:00
|
|
|
struct Kernel
|
|
|
|
{
|
2016-03-23 00:55:42 -04:00
|
|
|
static Kernel& systemKernel();
|
2016-03-23 00:33:45 -04:00
|
|
|
|
2016-03-23 00:56:00 -04:00
|
|
|
Kernel();
|
|
|
|
|
2016-03-25 01:21:49 -04:00
|
|
|
/** Initialize the system. */
|
|
|
|
void initialize(const StartupInformation& startupInformation);
|
2016-03-23 00:56:00 -04:00
|
|
|
|
2016-03-25 01:21:49 -04:00
|
|
|
/**
|
|
|
|
* Put up a panic screen and halt the system.
|
|
|
|
* @see halt()
|
|
|
|
*/
|
2016-03-23 00:33:45 -04:00
|
|
|
void panic(const char* msg, ...);
|
|
|
|
|
2016-03-25 01:21:49 -04:00
|
|
|
/** Disable interrupts and halt the system. You will never return from that place... */
|
2016-03-23 00:33:45 -04:00
|
|
|
void halt() NORETURN;
|
2016-03-23 00:56:00 -04:00
|
|
|
|
2016-03-23 01:42:52 -04:00
|
|
|
Console& console();
|
|
|
|
|
2016-03-23 00:56:00 -04:00
|
|
|
private:
|
|
|
|
Console mConsole;
|
2016-03-25 01:21:49 -04:00
|
|
|
MemoryManager mMemoryManager;
|
2016-03-23 00:33:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace kernel */
|
|
|
|
|
|
|
|
#endif /* __KERNEL_HH__ */
|