Skip to content

always cover at least the first 4 GiB of physical memory #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions common/src/legacy_memory_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,17 @@ where
///
/// Useful for creating a mapping for all physical memory.
pub fn max_phys_addr(&self) -> PhysAddr {
self.original
let max = self
.original
.clone()
.map(|r| r.start() + r.len())
.max()
.unwrap()
.unwrap();

// Always cover at least the first 4 GiB of physical memory. That area
// contains useful MMIO regions (local APIC, I/O APIC, PCI bars) that
// we want to make accessible to the kernel even if no DRAM exists >4GiB.
cmp::max(max, PhysAddr::new(0x1_0000_0000))
}

/// Calculate the maximum number of regions produced by [Self::construct_memory_map]
Expand Down
Loading