1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +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

@ -155,8 +155,9 @@ UNMAP_AFTER_INIT RTL8139NetworkAdapter::~RTL8139NetworkAdapter()
{
}
void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
bool RTL8139NetworkAdapter::handle_irq(const RegisterState&)
{
bool was_handled = false;
for (;;) {
int status = in16(REG_ISR);
out16(REG_ISR, status);
@ -168,6 +169,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
if ((status & (INT_RXOK | INT_RXERR | INT_TXOK | INT_TXERR | INT_RX_BUFFER_OVERFLOW | INT_LINK_CHANGE | INT_RX_FIFO_OVERFLOW | INT_LENGTH_CHANGE | INT_SYSTEM_ERROR)) == 0)
break;
was_handled = true;
if (status & INT_RXOK) {
dbgln_if(RTL8139_DEBUG, "RTL8139: RX ready");
receive();
@ -201,6 +203,7 @@ void RTL8139NetworkAdapter::handle_irq(const RegisterState&)
reset();
}
}
return was_handled;
}
void RTL8139NetworkAdapter::reset()