1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

Kernel: Detect APs and boot them into protected mode

This isn't fully working, the APs pretend like they're
fully initialized and are just halted permanently for now.
This commit is contained in:
Tom 2020-06-04 09:10:16 -06:00 committed by Andreas Kling
parent 93b9832fac
commit 0bc92c259d
9 changed files with 463 additions and 108 deletions

View file

@ -121,6 +121,7 @@ extern "C" [[noreturn]] void init()
for (ctor_func_t* ctor = &start_ctors; ctor < &end_ctors; ctor++)
(*ctor)();
APIC::initialize();
InterruptManagement::initialize();
ACPI::initialize();
@ -161,6 +162,26 @@ extern "C" [[noreturn]] void init()
ASSERT_NOT_REACHED();
}
//
// This is where C++ execution begins for APs, after boot.S transfers control here.
//
// The purpose of init_ap() is to initialize APs for multi-tasking.
//
extern "C" [[noreturn]] void init_ap(u32 cpu)
{
APIC::the().enable(cpu);
#if 0
Scheduler::idle_loop();
#else
// FIXME: remove once schedule can handle APs
cli();
for (;;)
asm volatile("hlt");
#endif
ASSERT_NOT_REACHED();
}
void init_stage2()
{
SyncTask::spawn();