Files
blog_os/src/interrupts/mod.rs
Philipp Oppermann e8b3a1fff1 Catch divide error instead of page fault
The divide error pushes no error code. Thus we avoid stack misalignment (see #184).
2016-06-25 17:12:04 +02:00

23 lines
369 B
Rust

mod idt;
lazy_static! {
static ref IDT: idt::Idt = {
let mut idt = idt::Idt::new();
idt.set_handler(0, divide_by_zero_handler);
idt
};
}
pub fn init() {
IDT.load();
}
use vga_buffer::print_error;
extern "C" fn divide_by_zero_handler() -> ! {
unsafe { print_error(format_args!("EXCEPTION: DIVIDE BY ZERO")) };
loop {}
}