Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96f58f2

Browse filesBrowse files
authored
Merge pull request #448 from rust-osdev/fix/always-cover-4g
always cover at least the first 4 GiB of physical memory
2 parents bf950a4 + bf104bd commit 96f58f2
Copy full SHA for 96f58f2

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎common/src/legacy_memory_region.rs

Copy file name to clipboardExpand all lines: common/src/legacy_memory_region.rs
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,17 @@ where
132132
///
133133
/// Useful for creating a mapping for all physical memory.
134134
pub fn max_phys_addr(&self) -> PhysAddr {
135-
self.original
135+
let max = self
136+
.original
136137
.clone()
137138
.map(|r| r.start() + r.len())
138139
.max()
139-
.unwrap()
140+
.unwrap();
141+
142+
// Always cover at least the first 4 GiB of physical memory. That area
143+
// contains useful MMIO regions (local APIC, I/O APIC, PCI bars) that
144+
// we want to make accessible to the kernel even if no DRAM exists >4GiB.
145+
cmp::max(max, PhysAddr::new(0x1_0000_0000))
140146
}
141147

142148
/// Calculate the maximum number of regions produced by [Self::construct_memory_map]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.