2022-11-19 16:59:49 +00:00
|
|
|
#include "boot/Init.h"
|
2022-11-15 18:10:32 +00:00
|
|
|
#include "arch/CPU.h"
|
2022-11-13 11:20:53 +00:00
|
|
|
#include "arch/Serial.h"
|
2022-11-19 16:59:49 +00:00
|
|
|
#include "boot/bootboot.h"
|
|
|
|
#include "memory/MemoryManager.h"
|
|
|
|
#include "video/Framebuffer.h"
|
2022-11-13 11:20:53 +00:00
|
|
|
#include <String.h>
|
|
|
|
|
|
|
|
extern BOOTBOOT bootboot;
|
|
|
|
|
|
|
|
void Init::check_magic()
|
|
|
|
{
|
|
|
|
if (memcmp(bootboot.magic, BOOTBOOT_MAGIC, 4))
|
|
|
|
{
|
|
|
|
Serial::println("ERROR: Invalid magic value from bootloader");
|
|
|
|
for (;;)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init::early_init()
|
|
|
|
{
|
2022-11-19 19:01:01 +00:00
|
|
|
CPU::disable_interrupts();
|
|
|
|
|
2022-11-13 11:20:53 +00:00
|
|
|
Framebuffer::init();
|
2022-11-13 13:29:59 +00:00
|
|
|
MemoryManager::init();
|
2022-11-15 18:10:32 +00:00
|
|
|
|
|
|
|
CPU::platform_init();
|
2022-11-16 19:02:04 +00:00
|
|
|
|
|
|
|
check(MemoryManager::protect_kernel_sections().has_value());
|
2022-11-13 11:20:53 +00:00
|
|
|
}
|