mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
Add a double fault handler (and trigger it)
This commit is contained in:
@@ -93,6 +93,7 @@ lazy_static! {
|
|||||||
idt.set_handler(0, handler!(divide_by_zero_handler));
|
idt.set_handler(0, handler!(divide_by_zero_handler));
|
||||||
idt.set_handler(3, handler!(breakpoint_handler));
|
idt.set_handler(3, handler!(breakpoint_handler));
|
||||||
idt.set_handler(6, handler!(invalid_opcode_handler));
|
idt.set_handler(6, handler!(invalid_opcode_handler));
|
||||||
|
idt.set_handler(8, handler_with_error_code!(double_fault_handler));
|
||||||
idt.set_handler(14, handler_with_error_code!(page_fault_handler));
|
idt.set_handler(14, handler_with_error_code!(page_fault_handler));
|
||||||
|
|
||||||
idt
|
idt
|
||||||
@@ -150,3 +151,8 @@ extern "C" fn page_fault_handler(stack_frame: &ExceptionStackFrame, error_code:
|
|||||||
stack_frame);
|
stack_frame);
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" fn double_fault_handler(stack_frame: &ExceptionStackFrame, _error_code: u64) {
|
||||||
|
println!("\nEXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) {
|
|||||||
// initialize our IDT
|
// initialize our IDT
|
||||||
interrupts::init();
|
interrupts::init();
|
||||||
|
|
||||||
// trigger a breakpoint exception
|
// trigger a debug exception
|
||||||
unsafe { int!(3) };
|
unsafe { int!(1) };
|
||||||
|
|
||||||
println!("It did not crash!");
|
println!("It did not crash!");
|
||||||
loop {}
|
loop {}
|
||||||
|
|||||||
Reference in New Issue
Block a user