diff --git a/src/asm/ram64.s b/src/asm/ram64.s index 4f9ca392..0dc81b46 100644 --- a/src/asm/ram64.s +++ b/src/asm/ram64.s @@ -23,7 +23,3 @@ ram64_start: movq $ram_max, %rsp jmp rust64_start - -halt_loop: - hlt - jmp halt_loop \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 2b267b83..78f7a86c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,8 @@ use core::panic::PanicInfo; +use x86_64::instructions::hlt; + #[macro_use] mod serial; @@ -40,15 +42,13 @@ mod virtio; #[cfg(not(test))] global_asm!(include_str!("asm/ram64.s")); -extern "C" { - fn halt_loop() -> !; -} - #[cfg(all(not(test), feature = "log-panic"))] #[panic_handler] fn panic(info: &PanicInfo) -> ! { log!("PANIC: {}", info); - unsafe { halt_loop() } + loop { + hlt() + } } #[cfg(all(not(test), not(feature = "log-panic")))] @@ -181,6 +181,5 @@ pub extern "C" fn rust64_start() -> ! { }, ); - log!("Unable to boot from any virtio-blk device. Halting.."); - unsafe { halt_loop() } + panic!("Unable to boot from any virtio-blk device") }