Move common VM functionality into a library.
Bug: 223166344
Test: Ran unprotected VM under crosvm.
Change-Id: I3b027c3a5de037c2adc75cf816518d8db5e10587
diff --git a/pvmfw/src/main.rs b/pvmfw/src/main.rs
index 395c252..3fe3435 100644
--- a/pvmfw/src/main.rs
+++ b/pvmfw/src/main.rs
@@ -17,12 +17,9 @@
#![no_main]
#![no_std]
-mod console;
mod exceptions;
-mod uart;
-use core::panic::PanicInfo;
-use psci::{system_off, system_reset};
+use vmbase::{console, power::shutdown, println};
/// Entry point for pVM firmware.
#[no_mangle]
@@ -30,14 +27,5 @@
console::init();
println!("Hello world");
- system_off().unwrap();
- #[allow(clippy::empty_loop)]
- loop {}
-}
-
-#[panic_handler]
-fn panic(info: &PanicInfo) -> ! {
- eprintln!("{}", info);
- system_reset().unwrap();
- loop {}
+ shutdown();
}