Pass x0-x3 boot values to Rust main function.
Bug: 223166344
Test: Ran --unprotected-vm-with-firmware with patched crosvm.
Test: Ran unprotected VM with crosvm.
Change-Id: I1b7d795ab1964741dac1983d4503aa96de818964
diff --git a/vmbase/src/entry.rs b/vmbase/src/entry.rs
index dd7f6db..1510ae2 100644
--- a/vmbase/src/entry.rs
+++ b/vmbase/src/entry.rs
@@ -18,17 +18,17 @@
/// This is the entry point to the Rust code, called from the binary entry point in `entry.S`.
#[no_mangle]
-extern "C" fn rust_entry() -> ! {
+extern "C" fn rust_entry(x0: u64, x1: u64, x2: u64, x3: u64) -> ! {
console::init();
unsafe {
- main();
+ main(x0, x1, x2, x3);
}
shutdown();
}
extern "Rust" {
/// Main function provided by the application using the `main!` macro.
- fn main();
+ fn main(arg0: u64, arg1: u64, arg2: u64, arg3: u64);
}
/// Marks the main function of the binary.
@@ -49,9 +49,9 @@
($name:path) => {
// Export a symbol with a name matching the extern declaration above.
#[export_name = "main"]
- fn __main() {
+ fn __main(arg0: u64, arg1: u64, arg2: u64, arg3: u64) {
// Ensure that the main function provided by the application has the correct type.
- $name()
+ $name(arg0, arg1, arg2, arg3)
}
};
}