From eabe759ebfdd366bef93c473381815d9ea6e2955 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 10 Sep 2024 16:19:43 +0300 Subject: [PATCH] Kernel: Don't require APs that are not started to start :D --- kernel/kernel/APIC.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kernel/kernel/APIC.cpp b/kernel/kernel/APIC.cpp index af07bf7cc6..69bc0c9dc3 100644 --- a/kernel/kernel/APIC.cpp +++ b/kernel/kernel/APIC.cpp @@ -277,6 +277,7 @@ namespace Kernel memcpy(PageTable::fast_page_as_ptr(), g_ap_init_addr, PAGE_SIZE); }); + uint8_t initialized_aps = 0; for (auto& processor : m_processors) { if (processor.apic_id == bsp_id) @@ -339,15 +340,17 @@ namespace Kernel udelay(100); } }); + + initialized_aps++; } __atomic_store_n(&g_ap_startup_done[0], 1, __ATOMIC_SEQ_CST); const size_t timeout_ms = SystemTimer::get().ms_since_boot() + 500; - while (__atomic_load_n(&g_ap_running_count[0], __ATOMIC_SEQ_CST) < m_processors.size() - 1) + while (__atomic_load_n(&g_ap_running_count[0], __ATOMIC_SEQ_CST) < initialized_aps) { if (SystemTimer::get().ms_since_boot() >= timeout_ms) - Kernel::panic("Could not start all processors"); + Kernel::panic("Could not start all APs ({}/{} started)", g_ap_running_count[0], initialized_aps); __builtin_ia32_pause(); }