Skip to content

Commit

Permalink
build: Merge rust64_start() for coreboot and pvh
Browse files Browse the repository at this point in the history
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]
#203 (comment)

Signed-off-by: Akira Moroo <[email protected]>
  • Loading branch information
retrage committed Oct 31, 2022
1 parent 1299c58 commit 3bed774
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) -> ! {
Expand Down

0 comments on commit 3bed774

Please sign in to comment.