Luna/kernel/src/boot/Init.cpp

35 lines
739 B
C++
Raw Normal View History

2022-11-19 16:59:49 +00:00
#include "boot/Init.h"
2022-11-30 12:29:28 +00:00
#include "Log.h"
2022-11-15 18:10:32 +00:00
#include "arch/CPU.h"
2022-11-19 16:59:49 +00:00
#include "boot/bootboot.h"
#include "memory/MemoryManager.h"
#include "video/Framebuffer.h"
2022-12-07 10:40:02 +00:00
#include <luna/Result.h>
2022-12-07 11:25:42 +00:00
#include <luna/String.h>
2022-11-13 11:20:53 +00:00
extern const BOOTBOOT bootboot;
2022-11-13 11:20:53 +00:00
void Init::check_magic()
{
if (memcmp(bootboot.magic, BOOTBOOT_MAGIC, 4))
{
2022-11-30 16:16:36 +00:00
kerrorln("ERROR: Invalid magic value from bootloader");
2022-11-13 11:20:53 +00:00
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-30 12:29:28 +00:00
setup_log(log_debug_enabled(), log_serial_enabled(), true);
MemoryManager::init();
2022-11-15 18:10:32 +00:00
CPU::platform_init();
MemoryManager::protect_kernel_sections().expect_release_value("We should succeed to protect sections");
2022-11-13 11:20:53 +00:00
}