mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
Kernel: Fix some flaws that caused crashes or hangs during boot
We need to halt the BSP briefly until all APs are ready for the first context switch, but we can't hold the same spinlock by all of them while doing so. So, while the APs are waiting on each other they need to release the scheduler lock, and then once signaled re-acquire it. Should solve some timing dependent hangs or crashes, most easily observed using qemu with kvm disabled.
This commit is contained in:
parent
5d9ea2c787
commit
b02d33bd63
4 changed files with 146 additions and 120 deletions
|
@ -166,10 +166,7 @@ extern "C" [[noreturn]] void init_ap(u32 cpu, Processor* processor_info)
|
|||
{
|
||||
processor_info->early_initialize(cpu);
|
||||
|
||||
klog() << "CPU #" << cpu << " processor_info at " << VirtualAddress(FlatPtr(processor_info));
|
||||
|
||||
processor_info->initialize(cpu);
|
||||
APIC::the().enable(cpu);
|
||||
MemoryManager::initialize(cpu);
|
||||
|
||||
Scheduler::set_idle_thread(APIC::the().get_idle_thread(cpu));
|
||||
|
@ -184,7 +181,6 @@ extern "C" [[noreturn]] void init_ap(u32 cpu, Processor* processor_info)
|
|||
//
|
||||
extern "C" void init_finished(u32 cpu)
|
||||
{
|
||||
klog() << "CPU #" << cpu << " finished initialization";
|
||||
if (cpu == 0) {
|
||||
// TODO: we can reuse the boot stack, maybe for kmalloc()?
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue