Double fault

This commit is contained in:
greg 2019-07-11 02:51:00 -07:00
parent 596bb35697
commit 4c0ce08bc8
2 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,7 @@ lazy_static! {
static ref IDT: InterruptDescriptorTable = {
let mut idt = InterruptDescriptorTable::new();
idt.breakpoint.set_handler_fn(breakpoint_handler);
idt.double_fault.set_handler_fn(double_fault_handler);
idt
};
}
@ -18,3 +19,7 @@ extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut InterruptStackFra
println!("EXCEPTION - BREAKPOINT\n{:#?}", stack_frame);
}
extern "x86-interrupt" fn double_fault_handler(stack_frame: &mut InterruptStackFrame, code: u64) {
panic!("EXCEPTION - DOUBLE FAULT (code {})\n{:#?}", code, stack_frame);
}

View File

@ -22,15 +22,14 @@ pub fn init() {
pub extern "C" fn _start() -> ! {
init();
x86_64::instructions::interrupts::int3();
//x86_64::instructions::interrupts::int3();
unsafe {
asm!("mov dx, 0; div dx" ::: "ax", "dx" : "volatile", "intel")
*(0xf0f0b8b8 as *mut u64) = 10;
}
println!("Gamarjoba, munde: {}", 1);
println!("Gamarjoba, munde: {}", 2);
panic!("A bad thing happened");
loop {}
}