From 976562307acd2d58de962d887582d7cfb0d01b81 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 28 Feb 2020 18:26:44 +0200 Subject: [PATCH] Kernel: Initialize Spurious IRQ handlers in switch_to_pic_mode() --- Kernel/Interrupts/InterruptManagement.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Kernel/Interrupts/InterruptManagement.cpp b/Kernel/Interrupts/InterruptManagement.cpp index 0c6949c6686..8c035650195 100644 --- a/Kernel/Interrupts/InterruptManagement.cpp +++ b/Kernel/Interrupts/InterruptManagement.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #define PCAT_COMPAT_FLAG 0x1 @@ -91,6 +92,10 @@ void InterruptManagement::disable(u8 interrupt_vector) void InterruptManagement::eoi(u8 interrupt_vector) { + if (m_interrupt_controllers.size() == 1 && m_interrupt_controllers[0]->type() == IRQControllerType::i8259) { + m_interrupt_controllers[0]->eoi(interrupt_vector); + return; + } for (auto& irq_controller : InterruptManagement::the().m_interrupt_controllers) { ASSERT(irq_controller != nullptr); if (irq_controller->get_gsi_base() <= interrupt_vector) @@ -109,6 +114,8 @@ IRQController& InterruptManagement::get_interrupt_controller(int index) void InterruptManagement::switch_to_pic_mode() { kprintf("Interrupts: PIC mode by default\n"); + SpuriousInterruptHandler::initialize(7); + SpuriousInterruptHandler::initialize(15); } void InterruptManagement::switch_to_ioapic_mode() @@ -135,6 +142,8 @@ AdvancedInterruptManagement::AdvancedInterruptManagement(PhysicalAddress p_madt) void AdvancedInterruptManagement::switch_to_pic_mode() { kprintf("Interrupts: Switch to Legacy PIC mode\n"); + SpuriousInterruptHandler::initialize(7); + SpuriousInterruptHandler::initialize(15); for (auto& irq_controller : m_interrupt_controllers) { ASSERT(irq_controller); if (irq_controller->type() == IRQControllerType::i82093AA) {