diff --git a/src/arch/x86_64/kernel/mod.rs b/src/arch/x86_64/kernel/mod.rs index 5284b1eb83d1313508ea59783da1b25b9b0d17a9..7eeec90588f96a07643710d46f6489d07eb77424 100644 --- a/src/arch/x86_64/kernel/mod.rs +++ b/src/arch/x86_64/kernel/mod.rs @@ -9,7 +9,7 @@ use x86::controlregs::{cr0, cr0_write, cr4, Cr0}; use self::serial::SerialPort; use crate::arch::mm::{PhysAddr, VirtAddr}; use crate::arch::x86_64::kernel::core_local::*; -use crate::env; +use crate::env::{self, is_uhyve}; #[cfg(feature = "acpi")] pub mod acpi; @@ -141,11 +141,6 @@ pub fn get_processor_count() -> u32 { 1 } -/// Whether HermitCore is running under the "uhyve" hypervisor. -pub fn is_uhyve() -> bool { - matches!(boot_info().platform_info, PlatformInfo::Uhyve { .. }) -} - pub fn is_uhyve_with_pci() -> bool { match boot_info().platform_info { PlatformInfo::Multiboot { .. } => false, diff --git a/src/env.rs b/src/env.rs index e7dac28f97f751254a7c426d5ccfa60cd6c2da6d..b7e788b9f65379386fb1771a6f1b6f35ae3773d8 100644 --- a/src/env.rs +++ b/src/env.rs @@ -7,12 +7,14 @@ use core::{slice, str}; use ahash::RandomState; use hashbrown::hash_map::Iter; use hashbrown::HashMap; +use hermit_entry::boot_info::PlatformInfo; use hermit_sync::OnceCell; pub use crate::arch::kernel::{ get_base_address, get_cmdline, get_cmdsize, get_image_size, get_ram_address, get_tls_align, - get_tls_filesz, get_tls_memsz, get_tls_start, is_uhyve, + get_tls_filesz, get_tls_memsz, get_tls_start, }; +use crate::kernel::boot_info; static CLI: OnceCell<Cli> = OnceCell::new(); @@ -29,6 +31,11 @@ struct Cli { args: Vec<String>, } +/// Whether HermitCore is running under the "uhyve" hypervisor. +pub fn is_uhyve() -> bool { + matches!(boot_info().platform_info, PlatformInfo::Uhyve { .. }) +} + fn get_cmdline_str() -> &'static str { let cmdsize = get_cmdsize(); let cmdline = get_cmdline().as_ptr::<u8>(); diff --git a/src/lib.rs b/src/lib.rs index 3eef3c77bd27d09446eaab493cc474b84150850f..582daa54965fafdd91b74cdaf4961fa2eacfaa86 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,7 +47,7 @@ use core::sync::atomic::{AtomicU32, Ordering}; use arch::core_local::*; // Used for integration test status. #[doc(hidden)] -pub use arch::kernel::is_uhyve as _is_uhyve; +pub use env::is_uhyve as _is_uhyve; use mm::allocator::LockedAllocator; #[cfg(target_arch = "aarch64")] use qemu_exit::QEMUExit;