1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:57:44 +00:00

Kernel/Interrupts: Return boolean on whether we handled the interrupt

If we are in a shared interrupt handler, the called handlers might
indicate it was not their interrupt, so we should not increment the
call counter of these handlers.
This commit is contained in:
Liav A 2021-06-05 09:00:18 +03:00 committed by Andreas Kling
parent 7a6d5a7b8b
commit b91df26d4a
43 changed files with 125 additions and 71 deletions

View file

@ -63,7 +63,7 @@ SharedIRQHandler::~SharedIRQHandler()
disable_interrupt_vector();
}
void SharedIRQHandler::handle_interrupt(const RegisterState& regs)
bool SharedIRQHandler::handle_interrupt(const RegisterState& regs)
{
VERIFY_INTERRUPTS_DISABLED();
@ -71,16 +71,19 @@ void SharedIRQHandler::handle_interrupt(const RegisterState& regs)
dbgln("Interrupt @ {}", interrupt_number());
dbgln("Interrupt Handlers registered - {}", m_handlers.size());
}
int i = 0;
bool was_handled = false;
for (auto* handler : m_handlers) {
dbgln_if(INTERRUPT_DEBUG, "Going for Interrupt Handling @ {}, Shared Interrupt {}", i, interrupt_number());
VERIFY(handler != nullptr);
handler->increment_invoking_counter();
handler->handle_interrupt(regs);
if (handler->handle_interrupt(regs)) {
handler->increment_invoking_counter();
was_handled = true;
}
dbgln_if(INTERRUPT_DEBUG, "Going for Interrupt Handling @ {}, Shared Interrupt {} - End", i, interrupt_number());
i++;
}
return was_handled;
}
void SharedIRQHandler::enable_interrupt_vector()