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.segment_not_present .set_handler_fn(super::exceptions::segment_not_present_handler); idt.general_protection_fault .set_handler_fn(super::exceptions::general_protection_fault_handler); unsafe { idt.double_fault .set_handler_fn(super::exceptions::double_fault_handler) .set_stack_index(super::gdt::DOUBLE_FAULT_IST_INDEX); idt.page_fault .set_handler_fn(super::exceptions::page_fault_handler) .set_stack_index(super::gdt::PAGE_FAULT_IST_INDEX); } idt }; } pub fn init() { IDT.load() }