apio 73c58bd902
Init: Move platform_init() before MemoryManager::init()
This enables NX before we actually use it.
Wasn't causing problems with KVM on, but crashed with KVM off with a 'reserved bit set' page fault.
2022-12-26 12:12:55 +01:00

37 lines
786 B
C++

#include "boot/Init.h"
#include "InitRD.h"
#include "Log.h"
#include "arch/CPU.h"
#include "boot/bootboot.h"
#include "memory/MemoryManager.h"
#include "video/Framebuffer.h"
#include <luna/CString.h>
#include <luna/Result.h>
extern const BOOTBOOT bootboot;
void Init::check_magic()
{
if (memcmp(bootboot.magic, BOOTBOOT_MAGIC, 4))
{
kerrorln("ERROR: Invalid magic value from bootloader");
for (;;)
;
}
}
void Init::early_init()
{
CPU::disable_interrupts();
Framebuffer::init();
setup_log(log_debug_enabled(), log_serial_enabled(), true);
CPU::platform_init();
MemoryManager::init();
InitRD::initialize();
MemoryManager::protect_kernel_sections().expect_release_value("We should succeed to protect sections");
}