From 5d3dabed3ec1a09033c5d11b1bb9499eb99086bb Mon Sep 17 00:00:00 2001 From: Akira Moroo Date: Sat, 22 Oct 2022 15:05:55 +0900 Subject: [PATCH] build: Merge `rust64_start()` for coreboot and pvh This commit merges `rust64_start()` for coreboot and pvh so that the entry function is implemented for each architecture. This commit includes suggested changes in [1]. [1] https://github.com/cloud-hypervisor/rust-hypervisor-firmware/pull/203#discussion_r1008665312 Signed-off-by: Akira Moroo --- src/main.rs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/main.rs b/src/main.rs index a3458b0e..10a24b98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -128,27 +128,19 @@ fn boot_from_device(device: &mut block::VirtioBlockDevice, info: &dyn boot::Info } #[no_mangle] -#[cfg(not(feature = "coreboot"))] -pub extern "C" fn rust64_start(rdi: &pvh::StartInfo) -> ! { +pub extern "C" fn rust64_start(#[cfg(not(feature = "coreboot"))] pvh_info: &pvh::StartInfo) -> ! { serial::PORT.borrow_mut().init(); arch::x86_64::sse::enable_sse(); arch::x86_64::paging::setup(); - main(rdi) -} - -#[no_mangle] -#[cfg(feature = "coreboot")] -pub extern "C" fn rust64_start() -> ! { - serial::PORT.borrow_mut().init(); - - arch::x86_64::sse::enable_sse(); - arch::x86_64::paging::setup(); + #[cfg(feature = "coreboot")] + let info = &coreboot::StartInfo::default(); - let info = coreboot::StartInfo::default(); + #[cfg(not(feature = "coreboot"))] + let info = pvh_info; - main(&info) + main(info) } fn main(info: &dyn boot::Info) -> ! {