Skip to content

Commit

Permalink
Make the entry_point macro only available on x86_64
Browse files Browse the repository at this point in the history
Inline assembly causes build errors on other architectures.

We can still run the config tests on other architectures, so we don't want to set the `target_arch` for the entire crate.
  • Loading branch information
phil-opp committed Apr 26, 2024
1 parent 074e17a commit a263358
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ mod version_info {
/// `#[link_section = ".bootloader-config"]`, which instructs the Rust compiler to store it
/// in a special section of the resulting ELF executable. From there, the bootloader will
/// automatically read it when loading the kernel.
#[cfg(target_arch = "x86_64")]
#[macro_export]
macro_rules! entry_point {
($path:path) => {
Expand Down Expand Up @@ -139,6 +140,7 @@ macro_rules! entry_point {
}

#[doc(hidden)]
#[cfg(target_arch = "x86_64")]
pub fn __force_use(slice: &&[u8; BootloaderConfig::SERIALIZED_LEN]) {
let force_use = slice as *const _ as usize;
unsafe { core::arch::asm!("add {0}, 0", in(reg) force_use, options(nomem, nostack)) };
Expand Down

0 comments on commit a263358

Please sign in to comment.