From 596bb356979bcc4023b7876bc10dcff17dc17645 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 11 Jul 2019 02:44:26 -0700 Subject: [PATCH] Triple-fault by deliberately dividing by zero with no handler --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 2f39200..71dbf8b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -#![feature(abi_x86_interrupt)] +#![feature(abi_x86_interrupt, asm)] #![no_std] #![no_main] @@ -24,6 +24,10 @@ pub extern "C" fn _start() -> ! { init(); x86_64::instructions::interrupts::int3(); + unsafe { + asm!("mov dx, 0; div dx" ::: "ax", "dx" : "volatile", "intel") + } + println!("Gamarjoba, munde: {}", 1); println!("Gamarjoba, munde: {}", 2); panic!("A bad thing happened");