Handle double faults
This commit is contained in:
parent
cb33e987f1
commit
4cc21fdee8
|
@ -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
|
||||
};
|
||||
}
|
||||
|
@ -17,3 +18,7 @@ pub fn init_idt() {
|
|||
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
|
||||
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
|
||||
}
|
||||
|
||||
extern "x86-interrupt" fn double_fault_handler(stack_frame: InterruptStackFrame, _error_code: u64) -> ! {
|
||||
panic!("EXCEPTION : DOUBLE FAULT\n{:#?}", stack_frame);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ pub extern "C" fn _start() {
|
|||
|
||||
x86_64::instructions::interrupts::int3();
|
||||
|
||||
unsafe {
|
||||
*(0xdeadbeef as *mut u64) = 42;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
test_main();
|
||||
|
||||
|
|
Loading…
Reference in a new issue