mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:58:11 +00:00
Kernel/Interrupts: Initialize two spurious handlers when PIC is disabled
Even if the PIC was disabled it can still generate noise (spurious IRQs) so we need to register two handlers for handling such cases. Also, we declare interrupt service routine offset 0x20 to 0x2f as reserved, so when the PIC is disabled, we can handle spurious IRQs from the PIC at separate handlers.
This commit is contained in:
parent
7028a64997
commit
88c5992e0b
8 changed files with 169 additions and 5 deletions
|
@ -4,7 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Arch/x86/Interrupts.h>
|
||||
#include <Kernel/Interrupts/InterruptManagement.h>
|
||||
#include <Kernel/Interrupts/PIC.h>
|
||||
#include <Kernel/Interrupts/SpuriousInterruptHandler.h>
|
||||
#include <Kernel/Sections.h>
|
||||
|
||||
|
@ -16,6 +18,20 @@ UNMAP_AFTER_INIT void SpuriousInterruptHandler::initialize(u8 interrupt_number)
|
|||
handler->register_interrupt_handler();
|
||||
}
|
||||
|
||||
void SpuriousInterruptHandler::initialize_for_disabled_master_pic()
|
||||
{
|
||||
auto* handler = new SpuriousInterruptHandler(7);
|
||||
register_disabled_interrupt_handler(7, *handler);
|
||||
handler->enable_interrupt_vector_for_disabled_pic();
|
||||
}
|
||||
|
||||
void SpuriousInterruptHandler::initialize_for_disabled_slave_pic()
|
||||
{
|
||||
auto* handler = new SpuriousInterruptHandler(15);
|
||||
register_disabled_interrupt_handler(15, *handler);
|
||||
handler->enable_interrupt_vector_for_disabled_pic();
|
||||
}
|
||||
|
||||
void SpuriousInterruptHandler::register_handler(GenericInterruptHandler& handler)
|
||||
{
|
||||
VERIFY(!m_real_handler);
|
||||
|
@ -70,6 +86,12 @@ bool SpuriousInterruptHandler::handle_interrupt(const RegisterState& state)
|
|||
return true;
|
||||
}
|
||||
|
||||
void SpuriousInterruptHandler::enable_interrupt_vector_for_disabled_pic()
|
||||
{
|
||||
m_enabled = true;
|
||||
m_responsible_irq_controller = InterruptManagement::the().get_responsible_irq_controller(IRQControllerType::i8259, interrupt_number());
|
||||
}
|
||||
|
||||
void SpuriousInterruptHandler::enable_interrupt_vector()
|
||||
{
|
||||
if (m_enabled)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue