aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--StrixKernel/src/interrupts.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/StrixKernel/src/interrupts.rs b/StrixKernel/src/interrupts.rs
index 6c44f59..e55aa13 100644
--- a/StrixKernel/src/interrupts.rs
+++ b/StrixKernel/src/interrupts.rs
@@ -7,7 +7,8 @@ use lazy_static::lazy_static;
lazy_static! {
static ref IDT: InterruptDescriptorTable = {
let mut idt = InterruptDescriptorTable::new();
- idt.breakpoint.set_handler_fn(breakpoint_handler);
+ idt.breakpoint.set_handler_fn(breakpoint_handler); // breakpoint exception handler
+ idt.double_fault.set_handler_fn(double_fault_handler); // double fault exception handler // IMPORTANT (if not implemented would cause a triple fault and thus a system reset which is bad)
idt
};
}
@@ -16,12 +17,21 @@ pub fn init_idt() {
IDT.load();
}
+// Breakpoint exception
extern "x86-interrupt" fn breakpoint_handler(
stack_frame: InterruptStackFrame)
{
println!("EXCEPTION: BREAKPOINT\n{:#?}", stack_frame);
}
+// Double fault exception
+extern "x86-interrupt" fn double_fault_handler(
+ stack_frame: InterruptStackFrame, _error_code: u64) -> !
+{
+ panic!("EXCEPTION: DOUBLE FAULT\n{:#?}", stack_frame);
+}
+
+
// TESTS //
#[test_case]