]> git.lizzy.rs Git - loadnothing.git/commitdiff
Halt instead of looping and using 100% CPU
authorHimbeerserverDE <himbeerserverde@gmail.com>
Fri, 16 Sep 2022 18:43:07 +0000 (20:43 +0200)
committerHimbeerserverDE <himbeerserverde@gmail.com>
Fri, 16 Sep 2022 18:43:07 +0000 (20:43 +0200)
stage2/src/main.rs

index 75f787a76be732af69e690d0dc267ee7641aca61..2c663a35d5cfd32c2dc8bfbd07b22fa07136b0f5 100644 (file)
@@ -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");
+        }
+    }
 }