1 // Copyright 2022 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #![no_std] // don't link the Rust standard library 6 #![no_main] // disable all Rust-level entry points 7 8 use core::arch::asm; 9 use core::arch::global_asm; 10 use core::panic::PanicInfo; 11 12 use log::*; 13 14 global_asm!(include_str!("../src/boot.asm")); 15 16 /// This function is called on panic. 17 #[panic_handler] panic(_info: &PanicInfo) -> !18fn panic(_info: &PanicInfo) -> ! { 19 // Execute a debug breakpoint instruction to cause a VMEXIT. 20 // SAFETY: This instruction will exit the hosting VM, so no further Rust code will execute. 21 unsafe { 22 asm!("int3"); 23 } 24 // Just in case we are still running somehow, spin forever. 25 loop {} 26 } 27 28 #[no_mangle] main() -> !29pub extern "C" fn main() -> ! { 30 com_logger::init(); 31 error!("Hello World!"); 32 panic!(); 33 } 34