forked from CHatingPython/towos
feat: add interrupts handling, PIC and PIT
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
#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;
|
||||
@@ -16,6 +21,19 @@ void arch::init() {
|
||||
reload_segments(gdt::KERNEL_CS, gdt::KERNEL_DS);
|
||||
|
||||
m_idt.load();
|
||||
|
||||
m_picController.remap(0x20, 0x28);
|
||||
|
||||
static constexpr hwirq_t PIT_HWIRQ = 0x00;
|
||||
|
||||
m_picController.enable(PIT_HWIRQ);
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user