Kernel: IDT now sends EOI for every interrupt

EOI is sent before calling the interrupt handler. This should be fine
since all interrupts are processed with interrupts disabled
This commit is contained in:
Bananymous 2023-08-09 09:57:02 +03:00
parent a5b1555725
commit fd2bcc9156
2 changed files with 8 additions and 16 deletions

View File

@ -213,7 +213,7 @@ namespace IDT
extern "C" void cpp_irq_handler(uint64_t irq, Kernel::InterruptStack& interrupt_stack) extern "C" void cpp_irq_handler(uint64_t irq, Kernel::InterruptStack& interrupt_stack)
{ {
bool from_userspace = (interrupt_stack.cs & 0b11) & 0b11; bool from_userspace = (interrupt_stack.cs & 0b11) == 0b11;
if (from_userspace) if (from_userspace)
Kernel::Thread::current().save_sse(); Kernel::Thread::current().save_sse();
@ -224,21 +224,16 @@ namespace IDT
Kernel::Thread::current().set_return_rip(interrupt_stack.rip); Kernel::Thread::current().set_return_rip(interrupt_stack.rip);
} }
if (s_irq_handlers[irq]) if (!InterruptController::get().is_in_service(irq))
s_irq_handlers[irq](); dprintln("spurious irq 0x{2H}", irq);
else else
{ {
if (!InterruptController::get().is_in_service(irq))
{
dprintln("spurious irq 0x{2H}", irq);
return;
}
dprintln("no handler for irq 0x{2H}\n", irq);
}
// NOTE: Scheduler sends PIT eoi's
if (irq != PIT_IRQ)
InterruptController::get().eoi(irq); InterruptController::get().eoi(irq);
if (s_irq_handlers[irq])
s_irq_handlers[irq]();
else
dprintln("no handler for irq 0x{2H}\n", irq);
}
Kernel::Scheduler::get().reschedule_if_idling(); Kernel::Scheduler::get().reschedule_if_idling();

View File

@ -69,9 +69,6 @@ namespace Kernel
{ {
VERIFY_CLI(); VERIFY_CLI();
ASSERT(InterruptController::get().is_in_service(PIT_IRQ));
InterruptController::get().eoi(PIT_IRQ);
wake_threads(); wake_threads();
if (save_current_thread()) if (save_current_thread())