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 9726814

Browse filesBrowse files
committed
mark more entries as used
The bootloader maps some of the memory used by the kernel into its own address space as well. In order for that to work we must ensure that the bootloader doesn't already have memory mapped there. Mark regions that are likely to be used by the bootloader as unusable.
1 parent 7dcc963 commit 9726814
Copy full SHA for 9726814

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎common/src/level_4_entries.rs

Copy file name to clipboardExpand all lines: common/src/level_4_entries.rs
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ impl UsedLevel4Entries {
3939
rng: config.mappings.aslr.then(entropy::build_rng),
4040
};
4141

42-
used.entry_state[0] = true; // TODO: Can we do this dynamically?
42+
// The bootloader maps of the kernel's memory into its own page tables.
43+
// We need to prevent overlaps, so mark all memory that could already
44+
// be used by the bootload as inaccessible.
45+
46+
// All memory in this range is identity mapped.
47+
used.mark_range_as_used(0, max_phys_addr.as_u64());
48+
49+
// The bootload needs to access the frame buffer.
50+
if let Some(frame_buffer) = framebuffer {
51+
used.mark_range_as_used(frame_buffer.addr.as_u64(), frame_buffer.info.byte_len);
52+
}
4353

4454
// Mark the statically configured ranges from the config as used.
4555

0 commit comments

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