From 9448b0e025ff4241c68e9ffeeb28093726c7bf32 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 25 Jan 2019 13:49:09 +0100 Subject: [PATCH] Create a new IDT --- src/interrupts.rs | 8 +++++++- src/lib.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/interrupts.rs b/src/interrupts.rs index f9b98fd9..0be9ec40 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -1,5 +1,11 @@ -use x86_64::structures::idt::InterruptDescriptorTable; +use crate::println; +use x86_64::structures::idt::{ExceptionStackFrame, InterruptDescriptorTable}; pub fn init_idt() { let mut idt = InterruptDescriptorTable::new(); + idt.breakpoint.set_handler_fn(breakpoint_handler); +} + +extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut ExceptionStackFrame) { + println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame); } diff --git a/src/lib.rs b/src/lib.rs index 2bb61615..562de39e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(test), no_std)] +#![feature(abi_x86_interrupt)] pub mod interrupts; pub mod serial;