Luna/kernel/src/main.cpp
apio c2927de191
All checks were successful
continuous-integration/drone/push Build is passing
Remove unused includes
2022-12-07 11:22:34 +01:00

43 lines
1.1 KiB
C++

#include "Log.h"
#include "arch/CPU.h"
#include "arch/Timer.h"
#include "boot/Init.h"
#include "config.h"
#include "memory/MemoryManager.h"
#include <luna/Units.h>
Result<void> init()
{
kinfoln("Starting Moon %s", MOON_VERSION);
kinfoln("Current platform: %s", CPU::platform_string());
kinfoln("Current processor: %s", CPU::identify().value_or("(unknown)"));
Timer::init();
CPU::platform_finish_init();
CPU::enable_interrupts();
char buffer[64];
to_dynamic_unit(MemoryManager::total(), buffer, sizeof(buffer));
kinfoln("Total memory: %s", buffer);
to_dynamic_unit(MemoryManager::free(), buffer, sizeof(buffer));
kinfoln("Free memory: %s", buffer);
to_dynamic_unit(MemoryManager::used(), buffer, sizeof(buffer));
kinfoln("Used memory: %s", buffer);
to_dynamic_unit(MemoryManager::reserved(), buffer, sizeof(buffer));
kinfoln("Reserved memory: %s", buffer);
return {};
}
extern "C" [[noreturn]] void _start()
{
Init::check_magic();
Init::early_init();
auto rc = init();
if (rc.has_error()) kerrorln("Runtime error: %s", rc.error_string());
CPU::efficient_halt();
}