diff options
author | Tom <tomut@yahoo.com> | 2020-12-02 09:41:52 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-02 23:19:59 +0100 |
commit | 5e08ae4e14009d40ecd5f5428c6801eaeeffd125 (patch) | |
tree | 5271e3f26c8cc69b4815a9dd66ff1ac1ad291eda /Kernel/Arch/i386 | |
parent | aec8983819fa0cd23ce251f91305a8c2cb4450dc (diff) | |
download | serenity-5e08ae4e14009d40ecd5f5428c6801eaeeffd125.zip |
Kernel: Fix counting interrupts
Move counting interrupts out of the handle_interrupt method so that
it is done in all cases without the interrupt handler having to
implement it explicitly.
Also make the counter an atomic value as e.g. the LocalAPIC interrupts
may be triggered on multiple processors simultaneously.
Fixes #4297
Diffstat (limited to 'Kernel/Arch/i386')
-rw-r--r-- | Kernel/Arch/i386/CPU.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 0de723d461..eff69f9658 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -857,9 +857,11 @@ void handle_interrupt(TrapFrame* trap) auto& regs = *trap->regs; ASSERT(regs.isr_number >= IRQ_VECTOR_BASE && regs.isr_number <= (IRQ_VECTOR_BASE + GENERIC_INTERRUPT_HANDLERS_COUNT)); u8 irq = (u8)(regs.isr_number - 0x50); - ASSERT(s_interrupt_handler[irq]); - s_interrupt_handler[irq]->handle_interrupt(regs); - s_interrupt_handler[irq]->eoi(); + auto* handler = s_interrupt_handler[irq]; + ASSERT(handler); + handler->increment_invoking_counter(); + handler->handle_interrupt(regs); + handler->eoi(); } void enter_trap_no_irq(TrapFrame* trap) |