diff --git a/Kernel/Arch/x86_64/Interrupts.cpp b/Kernel/Arch/x86_64/Interrupts.cpp index eedb7097c6..e316dfda43 100644 --- a/Kernel/Arch/x86_64/Interrupts.cpp +++ b/Kernel/Arch/x86_64/Interrupts.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -371,6 +372,7 @@ void register_generic_interrupt_handler(u8 interrupt_number, GenericInterruptHan return; } VERIFY(handler_slot->type() == HandlerType::IRQHandler); + static_cast(handler_slot)->set_shared_with_others(true); auto& previous_handler = *handler_slot; handler_slot = nullptr; SharedIRQHandler::initialize(interrupt_number); @@ -400,6 +402,7 @@ void unregister_generic_interrupt_handler(u8 interrupt_number, GenericInterruptH } if (!handler_slot->is_shared_handler()) { VERIFY(handler_slot->type() == HandlerType::IRQHandler); + static_cast(handler_slot)->set_shared_with_others(false); handler_slot = nullptr; revert_to_unused_handler(interrupt_number); return; diff --git a/Kernel/Interrupts/IRQHandler.h b/Kernel/Interrupts/IRQHandler.h index c8b0eb2dd4..f21a524b42 100644 --- a/Kernel/Interrupts/IRQHandler.h +++ b/Kernel/Interrupts/IRQHandler.h @@ -32,6 +32,7 @@ public: virtual size_t sharing_devices_count() const override { return 0; } virtual bool is_shared_handler() const override { return false; } virtual bool is_sharing_with_others() const override { return m_shared_with_others; } + void set_shared_with_others(bool status) { m_shared_with_others = status; } protected: void change_irq_number(u8 irq);