2022-09-05 14:13:51 +00:00
|
|
|
#include "init/Init.h"
|
|
|
|
#include "assert.h"
|
|
|
|
#include "bootboot.h"
|
|
|
|
#include "cpu/CPU.h"
|
|
|
|
#include "interrupts/Interrupts.h"
|
|
|
|
#include "io/Serial.h"
|
2022-09-06 11:21:54 +00:00
|
|
|
#include "memory/RangeAllocator.h"
|
2022-09-06 11:49:17 +00:00
|
|
|
#include "memory/VMM.h"
|
2022-09-05 14:13:51 +00:00
|
|
|
#include "panic/hang.h"
|
2022-09-14 16:54:40 +00:00
|
|
|
#include "rand/Init.h"
|
|
|
|
#include "rand/Mersenne.h"
|
2022-09-10 16:42:40 +00:00
|
|
|
#include "render/Framebuffer.h"
|
2022-09-05 14:13:51 +00:00
|
|
|
#include "render/TextRenderer.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
extern BOOTBOOT bootboot;
|
|
|
|
|
2022-09-14 16:54:40 +00:00
|
|
|
uintptr_t __stack_chk_guard = 0xfeff34;
|
|
|
|
|
2022-09-05 14:13:51 +00:00
|
|
|
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");
|
|
|
|
|
2022-09-10 16:42:40 +00:00
|
|
|
framebuffer0.init((void*)bootboot.fb_ptr, bootboot.fb_type, bootboot.fb_scanline, bootboot.fb_width,
|
|
|
|
bootboot.fb_height);
|
2022-09-05 14:13:51 +00:00
|
|
|
// ASSERT(TextRenderer::try_initialize());
|
2022-09-06 11:21:54 +00:00
|
|
|
|
2022-09-06 16:08:15 +00:00
|
|
|
kernelPMM.init_from_mmap();
|
2022-09-06 11:49:17 +00:00
|
|
|
kernelVMM.init();
|
2022-09-14 16:54:40 +00:00
|
|
|
|
|
|
|
Mersenne::init();
|
|
|
|
|
|
|
|
__stack_chk_guard = Mersenne::get();
|
2022-09-05 14:13:51 +00:00
|
|
|
}
|