summaryrefslogtreecommitdiff
path: root/kernel/src/interrupts/exception_handlers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/interrupts/exception_handlers.rs')
-rw-r--r--kernel/src/interrupts/exception_handlers.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/src/interrupts/exception_handlers.rs b/kernel/src/interrupts/exception_handlers.rs
index cd223bb..ef67eff 100644
--- a/kernel/src/interrupts/exception_handlers.rs
+++ b/kernel/src/interrupts/exception_handlers.rs
@@ -35,6 +35,16 @@ pub extern "x86-interrupt" fn breakpoint_handler(stack_frame: &mut InterruptStac
}
}
+pub extern "x86-interrupt" fn div_zero_handler(stack_frame: &mut InterruptStackFrame) {
+ match get_expected_fault() {
+ InterruptType::DivZero => qemu::exit_qemu(qemu::QemuExitCode::Success),
+ _ => panic!(
+ "Divide by zero exception thrown\n\n{}",
+ exception_default!(stack_frame)
+ ),
+ }
+}
+
pub extern "x86-interrupt" fn general_protection_fault_handler(
stack_frame: &mut InterruptStackFrame,
error_code: u64,