diff --git a/src/arch/x86_64/kernel/mod.rs b/src/arch/x86_64/kernel/mod.rs index 6671ce84ec..480ffa4eea 100644 --- a/src/arch/x86_64/kernel/mod.rs +++ b/src/arch/x86_64/kernel/mod.rs @@ -4,7 +4,6 @@ use core::num::NonZeroU64; use core::ptr; use core::sync::atomic::{AtomicPtr, AtomicU32, Ordering}; -use fdt::Fdt; use hermit_entry::boot_info::{BootInfo, PlatformInfo, RawBootInfo}; use hermit_sync::InterruptSpinMutex; use x86::controlregs::{cr0, cr0_write, cr4, Cr0}; @@ -82,13 +81,6 @@ pub fn get_mbinfo() -> Option { } } -pub fn get_fdt() -> Option> { - boot_info().hardware_info.device_tree.map(|fdt| { - let ptr = ptr::with_exposed_provenance(fdt.get().try_into().unwrap()); - unsafe { Fdt::from_ptr(ptr).unwrap() } - }) -} - #[cfg(feature = "smp")] pub fn get_possible_cpus() -> u32 { use core::cmp; diff --git a/src/arch/x86_64/mm/physicalmem.rs b/src/arch/x86_64/mm/physicalmem.rs index 8761e708b0..0a0e8cc444 100644 --- a/src/arch/x86_64/mm/physicalmem.rs +++ b/src/arch/x86_64/mm/physicalmem.rs @@ -4,7 +4,7 @@ use free_list::{AllocError, FreeList, PageLayout, PageRange}; use hermit_sync::InterruptTicketMutex; use multiboot::information::{MemoryType, Multiboot}; -use crate::arch::x86_64::kernel::{get_fdt, get_limit, get_mbinfo}; +use crate::arch::x86_64::kernel::{get_limit, get_mbinfo}; use crate::arch::x86_64::mm::paging::{BasePageSize, PageSize}; use crate::arch::x86_64::mm::{MultibootMemory, PhysAddr, VirtAddr}; use crate::{env, mm}; @@ -18,7 +18,7 @@ const KVM_32BIT_GAP_SIZE: usize = 768 << 20; const KVM_32BIT_GAP_START: usize = KVM_32BIT_MAX_MEM_SIZE - KVM_32BIT_GAP_SIZE; fn detect_from_fdt() -> Result<(), ()> { - let fdt = get_fdt().ok_or(())?; + let fdt = env::fdt().ok_or(())?; let mems = fdt.find_all_nodes("/memory"); let all_regions = mems.map(|m| m.reg().unwrap().next().unwrap()); diff --git a/src/lib.rs b/src/lib.rs index aaa349c898..b59286953c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -195,8 +195,7 @@ fn boot_processor_main() -> ! { info!("Welcome to Hermit {}", env!("CARGO_PKG_VERSION")); info!("Kernel starts at {:p}", env::get_base_address()); - #[cfg(target_arch = "x86_64")] - if let Some(fdt) = kernel::get_fdt() { + if let Some(fdt) = env::fdt() { info!("FDT:\n{fdt:#?}"); }