forked from Bananymous/banan-os
55 lines
986 B
C++
55 lines
986 B
C++
#include <kernel/GDT.h>
|
|
#include <kernel/IDT.h>
|
|
#include <kernel/IO.h>
|
|
#include <kernel/Keyboard.h>
|
|
#include <kernel/kmalloc.h>
|
|
#include <kernel/kprint.h>
|
|
#include <kernel/multiboot.h>
|
|
#include <kernel/panic.h>
|
|
#include <kernel/PIC.h>
|
|
#include <kernel/PIT.h>
|
|
#include <kernel/RTC.h>
|
|
#include <kernel/Serial.h>
|
|
#include <kernel/Shell.h>
|
|
#include <kernel/tty.h>
|
|
|
|
#define DISABLE_INTERRUPTS() asm volatile("cli")
|
|
#define ENABLE_INTERRUPTS() asm volatile("sti")
|
|
|
|
multiboot_info_t* s_multiboot_info;
|
|
|
|
extern "C"
|
|
void kernel_main(multiboot_info_t* mbi, uint32_t magic)
|
|
{
|
|
DISABLE_INTERRUPTS();
|
|
|
|
s_multiboot_info = mbi;
|
|
|
|
if (magic != 0x2BADB002)
|
|
return;
|
|
|
|
Serial::initialize();
|
|
TTY::initialize();
|
|
|
|
kmalloc_initialize();
|
|
|
|
PIC::initialize();
|
|
gdt_initialize();
|
|
IDT::initialize();
|
|
|
|
PIT::initialize();
|
|
if (!Keyboard::initialize())
|
|
return;
|
|
|
|
kprintln("Hello from the kernel!");
|
|
|
|
ENABLE_INTERRUPTS();
|
|
|
|
auto& shell = Kernel::Shell::Get();
|
|
shell.Run();
|
|
|
|
for (;;)
|
|
{
|
|
asm("hlt");
|
|
}
|
|
} |