From aff0c339b486f29006ba791983cd716e2a2ff307 Mon Sep 17 00:00:00 2001 From: Josh Abraham Date: Mon, 21 May 2018 17:14:58 -1000 Subject: [PATCH] Fix TODO: Use triple fault to guarantee reboot Cause interrupt, since the IDT is dorked we can't find the INT 3 handler (double fault), and the double fault handler can't be found (triple fault). --- src/arch/x86_64/stop.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/arch/x86_64/stop.rs b/src/arch/x86_64/stop.rs index ae084f0..ec0b23a 100644 --- a/src/arch/x86_64/stop.rs +++ b/src/arch/x86_64/stop.rs @@ -14,7 +14,10 @@ pub unsafe extern fn kreset() -> ! { port.write(0xFE); } - // TODO: Use triple fault to guarantee reset + // Use triple fault to guarantee reset + asm!("cli" : : : : "intel", "volatile"); + asm!("lidt cs:0" : : : : "intel", "volatile"); + asm!("int $$3" : : : : "intel", "volatile"); unreachable!(); }