forked from Bananymous/banan-os
Kernel: Move Interruptable from InterruptController.h to its own file
This commit is contained in:
29
kernel/kernel/Interruptable.cpp
Normal file
29
kernel/kernel/Interruptable.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <kernel/IDT.h>
|
||||
#include <kernel/Interruptable.h>
|
||||
#include <kernel/InterruptController.h>
|
||||
#include <kernel/Processor.h>
|
||||
|
||||
namespace Kernel
|
||||
{
|
||||
|
||||
void Interruptable::set_irq(int irq)
|
||||
{
|
||||
auto& processor = Processor::current();
|
||||
if (m_irq != -1)
|
||||
processor.idt().register_irq_handler(m_irq, nullptr);
|
||||
m_irq = irq;
|
||||
processor.idt().register_irq_handler(irq, this);
|
||||
}
|
||||
|
||||
void Interruptable::enable_interrupt()
|
||||
{
|
||||
ASSERT(m_irq != -1);
|
||||
InterruptController::get().enable_irq(m_irq);
|
||||
}
|
||||
|
||||
void Interruptable::disable_interrupt()
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user