macro_rules! set_general_handler {
($idt:expr, $handler:ident) => { ... };
($idt:expr, $handler:ident, $idx:literal) => { ... };
($idt:expr, $handler:ident, $range:expr) => { ... };
}
Expand description
Set a general handler in an InterruptDescriptorTable
.
#![feature(abi_x86_interrupt)]
use x86_64::set_general_handler;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
let mut idt = InterruptDescriptorTable::new();
fn my_general_handler(
stack_frame: InterruptStackFrame,
index: u8,
error_code: Option<u64>,
) {
todo!("handle irq {}", index)
}
// set only one entry
set_general_handler!(&mut idt, my_general_handler, 14);
// set a range of entries
set_general_handler!(&mut idt, my_general_handler, 32..64);
// set all entries
set_general_handler!(&mut idt, my_general_handler);