summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/table.rs
blob: 64720140c46b9cc9393b379e129634a569a73d88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::io::vga_text::OStream;
use lazy_static::lazy_static;
use x86_64::structures::idt::InterruptDescriptorTable;

lazy_static! {
    static ref IDT: InterruptDescriptorTable = {
        let mut idt = InterruptDescriptorTable::new();
        idt.breakpoint
            .set_handler_fn(super::exceptions::breakpoint_handler);
        idt.page_fault
            .set_handler_fn(super::exceptions::page_fault_handler);
        idt.segment_not_present
            .set_handler_fn(super::exceptions::segment_not_present_handler);
        idt
    };
}

pub fn init() {
    IDT.load()
}