Begin work for exceptions post

This commit is contained in:
Philipp Oppermann
2016-05-13 15:54:19 +02:00
parent 7c565abba8
commit 431bb39fdb
4 changed files with 96 additions and 0 deletions

41
src/interrupts/mod.rs Normal file
View File

@@ -0,0 +1,41 @@
mod idt;
lazy_static! {
static ref IDT: idt::Idt = {
let mut idt = idt::Idt::new();
idt.set_handler(0, divide_by_zero_handler);
idt.set_handler(8, double_fault_handler);
idt.set_handler(13, general_protection_fault_handler);
idt.set_handler(14, page_fault_handler);
idt
};
}
pub fn init() {
assert_has_not_been_called!();
unsafe { IDT.load() }
}
pub extern fn divide_by_zero_handler() -> ! {
println!("EXCEPTION: DIVIDE BY ZERO");
loop {}
}
pub extern fn double_fault_handler() -> ! {
println!("EXCEPTION: DOUBLE FAULT");
loop {}
}
pub extern fn general_protection_fault_handler() -> ! {
println!("EXCEPTION: GENERAL PROTECTION FAULT");
loop {}
}
pub extern fn page_fault_handler() -> ! {
println!("EXCEPTION: PAGE FAULT");
loop {}
}