From fab320271af050838e7be8739c51e0b82943f6d2 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 18 Apr 2017 15:16:26 +0200 Subject: [PATCH] Create and load an IDT --- src/interrupts.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/interrupts.rs b/src/interrupts.rs index e94bec1..1ed361c 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -1,8 +1,15 @@ use x86_64::structures::idt::{Idt, ExceptionStackFrame}; +lazy_static! { + static ref IDT: Idt = { + let mut idt = Idt::new(); + idt.breakpoint.set_handler_fn(breakpoint_handler); + idt + }; +} + pub fn init() { - let mut idt = Idt::new(); - idt.breakpoint.set_handler_fn(breakpoint_handler); + IDT.load(); } extern "x86-interrupt" fn breakpoint_handler(