From 5756cd03222e61c68babae3a7b769ac24b58cbd0 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Fri, 16 Sep 2022 20:43:07 +0200 Subject: [PATCH] Halt instead of looping and using 100% CPU --- stage2/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stage2/src/main.rs b/stage2/src/main.rs index 75f787a..2c663a3 100644 --- a/stage2/src/main.rs +++ b/stage2/src/main.rs @@ -1,6 +1,7 @@ #![no_std] #![no_main] +use core::arch::asm; use core::panic::PanicInfo; static HELLO: &[u8] = b"Hello Stage2!"; @@ -31,5 +32,9 @@ pub extern "C" fn _start() -> ! { } } - loop {} + unsafe { + loop { + asm!("hlt"); + } + } } -- 2.44.0