mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-08 05:49:17 +00:00
Implemented GDT & IDT
This commit is contained in:
19
Kernel.cpp
19
Kernel.cpp
@ -1,6 +1,8 @@
|
||||
#include "kernel.h"
|
||||
|
||||
#include <interrupts.hpp>
|
||||
#include <display.hpp>
|
||||
#include <symbols.hpp>
|
||||
#include <memory.hpp>
|
||||
#include <string.h>
|
||||
#include <printf.h>
|
||||
@ -9,6 +11,7 @@
|
||||
|
||||
BootInfo *bInfo = nullptr;
|
||||
Video::Display *Display = nullptr;
|
||||
SymbolResolver::Symbols *KernelSymbolTable = nullptr;
|
||||
|
||||
// For the Display class. Printing on first buffer.
|
||||
extern "C" void putchar(char c) { Display->Print(c, 0); }
|
||||
@ -39,17 +42,25 @@ EXTERNC void kernel_aarch64_entry(uint64_t dtb_ptr32, uint64_t x1, uint64_t x2,
|
||||
|
||||
EXTERNC void kernel_entry(BootInfo *Info)
|
||||
{
|
||||
InitializeMemoryManagement(Info);
|
||||
trace("Hello, World!");
|
||||
InitializeMemoryManagement(Info);
|
||||
bInfo = (BootInfo *)KernelAllocator.RequestPages(TO_PAGES(sizeof(BootInfo)));
|
||||
memcpy(bInfo, Info, sizeof(BootInfo));
|
||||
debug("BootInfo structure is at %p", bInfo);
|
||||
Display = new Video::Display(bInfo->Framebuffer[0]);
|
||||
printf_("%s - %s(%s)\n", KERNEL_NAME, KERNEL_VERSION, GIT_COMMIT_SHORT);
|
||||
/**************************************************************************************/
|
||||
KPrint("Initializing GDT and IDT");
|
||||
Interrupts::Initialize();
|
||||
KPrint("Loading kernel symbols");
|
||||
KernelSymbolTable = new SymbolResolver::Symbols((uint64_t)Info->Kernel.FileBase);
|
||||
// printf_("%s\n", CPU::Vendor());
|
||||
// printf_("%s\n", CPU::Name());
|
||||
// printf_("%s\n", CPU::Hypervisor());
|
||||
Display->SetBuffer(0);
|
||||
for (size_t i = 0; i < 70; i++)
|
||||
KPrint("Hello, World! (%ld)", i);
|
||||
|
||||
for (size_t i = 0; i < 250; i++)
|
||||
KPrint("Hello, World! (%02ld)", i);
|
||||
asm("int $0x1");
|
||||
while (1)
|
||||
CPU::Halt();
|
||||
}
|
||||
|
Reference in New Issue
Block a user