diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index 77eace91d4..ed2bb59df3 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -108,9 +108,18 @@ UNMAP_AFTER_INIT bool CommandLine::is_ide_enabled() const UNMAP_AFTER_INIT bool CommandLine::is_smp_enabled() const { + // Note: We can't enable SMP mode without enabling the IOAPIC. + if (!is_ioapic_enabled()) + return false; return lookup("smp"sv).value_or("off"sv) == "on"sv; } +UNMAP_AFTER_INIT bool CommandLine::is_smp_enabled_without_ioapic_enabled() const +{ + auto smp_enabled = lookup("smp"sv).value_or("off"sv) == "on"sv; + return smp_enabled && !is_ioapic_enabled(); +} + UNMAP_AFTER_INIT bool CommandLine::is_ioapic_enabled() const { auto value = lookup("enable_ioapic"sv).value_or("on"sv); diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 5b4f2c37b6..e6b29f38a4 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -60,6 +60,7 @@ public: [[nodiscard]] bool is_boot_profiling_enabled() const; [[nodiscard]] bool is_ide_enabled() const; [[nodiscard]] bool is_ioapic_enabled() const; + [[nodiscard]] bool is_smp_enabled_without_ioapic_enabled() const; [[nodiscard]] bool is_smp_enabled() const; [[nodiscard]] bool is_physical_networking_disabled() const; [[nodiscard]] bool is_vmmouse_enabled() const; diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp index c0f57531a8..db39ae1637 100644 --- a/Kernel/Interrupts/InterruptManagement.cpp +++ b/Kernel/Interrupts/InterruptManagement.cpp @@ -40,7 +40,9 @@ UNMAP_AFTER_INIT void InterruptManagement::initialize() { VERIFY(!InterruptManagement::initialized()); s_interrupt_management = new InterruptManagement(); - + if (!kernel_command_line().is_smp_enabled_without_ioapic_enabled()) { + dbgln("Can't enable SMP mode without IOAPIC mode being enabled"); + } if (!kernel_command_line().is_ioapic_enabled() && !kernel_command_line().is_smp_enabled()) InterruptManagement::the().switch_to_pic_mode(); else