Luna/kernel/src/init/Init.cpp

35 lines
720 B
C++

#include "init/Init.h"
#include "assert.h"
#include "bootboot.h"
#include "cpu/CPU.h"
#include "interrupts/Interrupts.h"
#include "io/Serial.h"
#include "memory/RangeAllocator.h"
#include "panic/hang.h"
#include "render/Draw.h"
#include "render/TextRenderer.h"
#include <string.h>
extern BOOTBOOT bootboot;
void Init::check_magic()
{
ASSERT(strncmp((char*)bootboot.magic, BOOTBOOT_MAGIC, 4) == 0);
}
void Init::disable_smp()
{
if (CPU::get_initial_apic_id() != bootboot.bspid) { hang(); }
return;
}
void Init::early_init()
{
Interrupts::disable();
asm volatile("cld");
ASSERT(Draw::try_initialize());
// ASSERT(TextRenderer::try_initialize());
physical_allocator.init_from_mmap();
}