Kernel: Split Aarch64 CPU setup into two stages

Former aims to bring the processor itself into desired state,
while latter allows for additional initialization with heap available.
This commit is contained in:
konrad 2023-01-08 04:36:28 +01:00 committed by Jelle Raaijmakers
parent 97dce5d001
commit a8e9591bac
Notes: sideshowbarker 2024-07-19 16:58:44 +09:00
3 changed files with 10 additions and 3 deletions

View file

@ -27,7 +27,7 @@ extern "C" void enter_thread_context(Thread* from_thread, Thread* to_thread) __a
Processor* g_current_processor;
void Processor::initialize(u32 cpu)
void Processor::install(u32 cpu)
{
VERIFY(g_current_processor == nullptr);
m_features = detect_cpu_features();
@ -37,6 +37,10 @@ void Processor::initialize(u32 cpu)
g_current_processor = this;
}
void Processor::initialize()
{
}
[[noreturn]] void Processor::halt()
{
disable_interrupts();

View file

@ -44,7 +44,8 @@ class Processor {
public:
Processor() = default;
void initialize(u32 cpu);
void install(u32 cpu);
void initialize();
template<typename T>
T* get_specific()

View file

@ -147,7 +147,7 @@ extern "C" [[noreturn]] void init()
CommandLine::early_initialize("");
new (&bootstrap_processor()) Processor();
bootstrap_processor().initialize(0);
bootstrap_processor().install(0);
// We want to enable the MMU as fast as possible to make the boot faster.
init_page_tables();
@ -159,6 +159,8 @@ extern "C" [[noreturn]] void init()
(*ctor)();
kmalloc_init();
bootstrap_processor().initialize();
load_kernel_symbol_table();
CommandLine::initialize();