Add a double fault handler

This commit is contained in:
Philipp Oppermann
2017-04-18 18:11:52 +02:00
parent 91ffde4728
commit 2b9d880e48

View File

@@ -4,6 +4,7 @@ lazy_static! {
static ref IDT: Idt = { static ref IDT: Idt = {
let mut idt = Idt::new(); let mut idt = Idt::new();
idt.breakpoint.set_handler_fn(breakpoint_handler); idt.breakpoint.set_handler_fn(breakpoint_handler);
idt.double_fault.set_handler_fn(double_fault_handler);
idt idt
}; };
} }
@@ -17,3 +18,10 @@ extern "x86-interrupt" fn breakpoint_handler(
{ {
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame); println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
} }
extern "x86-interrupt" fn double_fault_handler(
stack_frame: &mut ExceptionStackFrame, _error_code: u64)
{
println!("\nEXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
loop {}
}