forked from Bananymous/banan-os
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:
parent
a5b1555725
commit
fd2bcc9156
|
@ -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,22 +224,17 @@ namespace IDT
|
||||||
Kernel::Thread::current().set_return_rip(interrupt_stack.rip);
|
Kernel::Thread::current().set_return_rip(interrupt_stack.rip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!InterruptController::get().is_in_service(irq))
|
||||||
|
dprintln("spurious irq 0x{2H}", irq);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InterruptController::get().eoi(irq);
|
||||||
if (s_irq_handlers[irq])
|
if (s_irq_handlers[irq])
|
||||||
s_irq_handlers[irq]();
|
s_irq_handlers[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);
|
dprintln("no handler for irq 0x{2H}\n", irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Scheduler sends PIT eoi's
|
|
||||||
if (irq != PIT_IRQ)
|
|
||||||
InterruptController::get().eoi(irq);
|
|
||||||
|
|
||||||
Kernel::Scheduler::get().reschedule_if_idling();
|
Kernel::Scheduler::get().reschedule_if_idling();
|
||||||
|
|
||||||
ASSERT(Kernel::Thread::current().state() != Kernel::Thread::State::Terminated);
|
ASSERT(Kernel::Thread::current().state() != Kernel::Thread::State::Terminated);
|
||||||
|
|
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue