diff --git a/src/arch/x86_64/rmm.rs b/src/arch/x86_64/rmm.rs index 1e4b7074bedca5f17c6fe3860048b3d574410ed0..328a922d88b9d8a0b148bd3fa4fc8cab7baf1d1e 100644 --- a/src/arch/x86_64/rmm.rs +++ b/src/arch/x86_64/rmm.rs @@ -80,7 +80,7 @@ unsafe fn inner<A: Arch>( kernel_base: usize, kernel_size_aligned: usize, stack_base: usize, stack_size_aligned: usize, env_base: usize, env_size_aligned: usize, - acpi_base: usize, acpi_size: usize + acpi_base: usize, acpi_size_aligned: usize ) -> BuddyAllocator<A> { // First, calculate how much memory we have let mut size = 0; @@ -163,6 +163,19 @@ unsafe fn inner<A: Arch>( flush.ignore(); // Not the active table } + // Map acpi with identity mapping + for i in 0..acpi_size_aligned / A::PAGE_SIZE { + let phys = PhysicalAddress::new(acpi_base + i * A::PAGE_SIZE); + let virt = A::phys_to_virt(phys); + let flags = page_flags::<A>(virt); + let flush = mapper.map_phys( + virt, + phys, + flags + ).expect("failed to map frame"); + flush.ignore(); // Not the active table + } + println!("Table: {:X}", mapper.table().phys().data()); for i in 0..512 { if let Some(entry) = mapper.table().entry(i) { diff --git a/src/arch/x86_64/start.rs b/src/arch/x86_64/start.rs index 65993ea0e9321ab9d8d2175d45b58dc341a7fdb9..508ad8098a5091f56753ee7ac1677eba76810742 100644 --- a/src/arch/x86_64/start.rs +++ b/src/arch/x86_64/start.rs @@ -172,7 +172,11 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! { // Read ACPI tables, starts APs #[cfg(feature = "acpi")] { - acpi::init(&mut active_table, if acpi_rsdps_base != 0 && acpi_rsdps_size > 0 { Some((acpi_rsdps_base, acpi_rsdps_size)) } else { None }); + acpi::init(&mut active_table, if acpi_rsdps_base != 0 && acpi_rsdps_size > 0 { + Some((acpi_rsdps_base + crate::PHYS_OFFSET as u64, acpi_rsdps_size)) + } else { + None + }); device::init_after_acpi(&mut active_table); }