Skip to content

Commit ddecc33

Browse files
committed
main: Replace infinite busy loop on exit with a HLT instruction
This prevents the guest vCPU from needlessly spinning. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
1 parent 91f37d2 commit ddecc33

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,9 @@ pub extern "C" fn _start() -> ! {
188188
boot_from_device(&mut device);
189189

190190
#[allow(clippy::empty_loop)]
191-
loop {}
191+
loop {
192+
unsafe {
193+
asm!("hlt");
194+
}
195+
}
192196
}

0 commit comments

Comments
 (0)