2022-11-19 17:59:49 +01:00
|
|
|
#include "boot/Init.h"
|
2022-12-23 11:33:23 +01:00
|
|
|
#include "InitRD.h"
|
2022-11-30 13:29:28 +01:00
|
|
|
#include "Log.h"
|
2022-11-15 19:10:32 +01:00
|
|
|
#include "arch/CPU.h"
|
2022-11-19 17:59:49 +01:00
|
|
|
#include "boot/bootboot.h"
|
|
|
|
#include "memory/MemoryManager.h"
|
|
|
|
#include "video/Framebuffer.h"
|
2022-12-16 20:40:04 +01:00
|
|
|
#include <luna/CString.h>
|
2022-12-07 11:40:02 +01:00
|
|
|
#include <luna/Result.h>
|
2022-11-13 12:20:53 +01:00
|
|
|
|
2022-12-05 13:04:01 +01:00
|
|
|
extern const BOOTBOOT bootboot;
|
2022-11-13 12:20:53 +01:00
|
|
|
|
|
|
|
void Init::check_magic()
|
|
|
|
{
|
|
|
|
if (memcmp(bootboot.magic, BOOTBOOT_MAGIC, 4))
|
|
|
|
{
|
2022-11-30 17:16:36 +01:00
|
|
|
kerrorln("ERROR: Invalid magic value from bootloader");
|
2022-12-30 18:36:22 +01:00
|
|
|
CPU::efficient_halt();
|
2022-11-13 12:20:53 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init::early_init()
|
|
|
|
{
|
2022-11-19 20:01:01 +01:00
|
|
|
CPU::disable_interrupts();
|
|
|
|
|
2022-11-13 12:20:53 +01:00
|
|
|
Framebuffer::init();
|
2022-11-30 13:29:28 +01:00
|
|
|
|
|
|
|
setup_log(log_debug_enabled(), log_serial_enabled(), true);
|
|
|
|
|
2022-12-26 12:12:55 +01:00
|
|
|
CPU::platform_init();
|
|
|
|
|
2022-11-13 14:29:59 +01:00
|
|
|
MemoryManager::init();
|
2022-12-23 11:33:23 +01:00
|
|
|
InitRD::initialize();
|
2022-11-15 19:10:32 +01:00
|
|
|
|
2022-12-04 15:14:07 +01:00
|
|
|
MemoryManager::protect_kernel_sections().expect_release_value("We should succeed to protect sections");
|
2023-01-02 13:07:29 +01:00
|
|
|
}
|