Skip to content

Commit

Permalink
main: Replace infinite busy loop on exit with a HLT instruction
Browse files Browse the repository at this point in the history
This prevents the guest vCPU from needlessly spinning.

Signed-off-by: Rob Bradford <[email protected]>
  • Loading branch information
rbradford committed Sep 23, 2019
1 parent 91f37d2 commit ddecc33
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,9 @@ pub extern "C" fn _start() -> ! {
boot_from_device(&mut device);

#[allow(clippy::empty_loop)]
loop {}
loop {
unsafe {
asm!("hlt");
}
}
}

0 comments on commit ddecc33

Please sign in to comment.