From 8b262daa3c1de34e5e200794c830e000e2aeaf8e Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 18 Jul 2019 10:31:02 -0700 Subject: [PATCH] Add halt loop --- src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 11f953d..0408d47 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,9 +10,9 @@ mod gdt; use core::panic::PanicInfo; #[panic_handler] -fn panic(info: &PanicInfo) -> !{ +fn panic(info: &PanicInfo) -> ! { println!("{}", info); - loop {} + halt_loop(); } pub fn init() { @@ -30,10 +30,12 @@ pub extern "C" fn _start() -> ! { for i in 1..10 { println!("Gamarjoba, munde: {}", i); } + halt_loop(); +} + +pub fn halt_loop() -> ! { loop { - for _ in 0..100_000 { - } - print!("-"); + x86_64::instructions::hlt(); } }