Interrupts: Handle double fault
This commit is contained in:
parent
79efbdc5a0
commit
084945688b
@ -5,6 +5,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
|
||||
};
|
||||
}
|
||||
@ -15,3 +16,11 @@ pub fn init_idt() {
|
||||
extern "x86-interrupt" fn breakpoint_handler(stack_frame: InterruptStackFrame) {
|
||||
println!("EXCEPTION: Breakpoint\n{:#?}", stack_frame);
|
||||
}
|
||||
|
||||
// The error code of the double-fault handler is always 0
|
||||
extern "x86-interrupt" fn double_fault_handler(
|
||||
stack_frame: InterruptStackFrame,
|
||||
_error_code: u64,
|
||||
) -> ! {
|
||||
panic!("Exception: Double fault\n{:#?}", stack_frame)
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ pub extern "C" fn _start() -> ! {
|
||||
x86_64::instructions::interrupts::int3();
|
||||
|
||||
println!("We're here now");
|
||||
unsafe {
|
||||
*(0xff00ff00 as *mut u64) = 44;
|
||||
}
|
||||
loop {}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user