BarinkOS/kernel/kernel.cpp

58 lines
1.1 KiB
C++
Raw Normal View History

2023-02-17 13:42:42 +00:00
/*
Copyright © Nigel Barink 2023
*/
#include "memory/memory.h"
#include "memory/KernelHeap.h"
#include "memory/gdt/gdtc.h"
#include "memory/TaskStateSegment.h"
#include "supervisorterminal/superVisorTerminal.h"
#include "drivers/vga/VBE.h"
2023-02-21 13:36:20 +00:00
#include "pci/pci.h"
#include "drivers/pit/pit.h"
2023-02-21 13:36:20 +00:00
#include "acpi/acpi.h"
2023-02-17 15:27:36 +00:00
#include "i386/processor.h"
#include "terminal/kterm.h"
#include "interrupts/idt.h"
#include "serial.h"
2023-02-21 13:36:20 +00:00
#include "storage/vfs/VFS.h"
#include "../CoreLib/Memory.h"
2023-02-17 15:27:36 +00:00
extern "C" void LoadGlobalDescriptorTable();
2023-02-17 13:46:44 +00:00
extern "C" void jump_usermode();
2023-02-17 13:42:42 +00:00
extern "C" void kernel ()
{
2023-02-17 13:42:42 +00:00
init_serial();
kterm_init();
2023-02-21 13:36:20 +00:00
setup_tss();
initGDT();
initidt();
LoadGlobalDescriptorTable();
flush_tss();
printf("Memory setup complete!\n");
2023-02-17 13:42:42 +00:00
// Enable interrupts
asm volatile("STI");
initHeap();
2023-02-17 13:42:42 +00:00
pit_initialise();
2023-02-21 13:36:20 +00:00
ACPI::initialize();
//PCI::Scan();
2023-02-17 15:27:36 +00:00
processor::initialize();
processor::enable_protectedMode();
2023-02-21 13:36:20 +00:00
VirtualFileSystem::initialize();
2023-02-17 13:46:44 +00:00
#ifdef USERMODE_RELEASE
// Lets jump into user mode
jump_usermode();
#else
startSuperVisorTerminal();
#endif
2023-02-17 13:42:42 +00:00
}