Enable/disable hardware interrupts in the IRQ's controller through IRQ manager.
38 lines
722 B
C++
38 lines
722 B
C++
#include "./arch.hpp"
|
|
|
|
#include "arch/x86_64/int.hpp"
|
|
#include "runtime.hpp" // IWYU pragma: keep
|
|
|
|
arch& arch::get() {
|
|
return x86_64::arch::get();
|
|
}
|
|
|
|
namespace x86_64 {
|
|
|
|
arch::arch() {}
|
|
|
|
arch& arch::get() {
|
|
static x86_64::arch s_arch;
|
|
return s_arch;
|
|
}
|
|
|
|
void arch::init() {
|
|
m_gdt.load();
|
|
reload_segments(gdt::KERNEL_CS, gdt::KERNEL_DS);
|
|
|
|
m_idt.load();
|
|
|
|
m_picController.remap(0x20, 0x28);
|
|
|
|
static constexpr hwirq_t PIT_HWIRQ = 0x00;
|
|
|
|
irq_t pitIrq = m_irqManager.allocate();
|
|
m_irqManager.bind(pitIrq, m_picController, PIT_HWIRQ, 0x20);
|
|
m_irqManager.register_handler(pitIrq, pit::handler, &m_pit);
|
|
m_irqManager.enable(pitIrq);
|
|
|
|
asm volatile("sti");
|
|
}
|
|
|
|
} // namespace x86_64
|