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 f317b0d

Browse filesBrowse files
committed
Don't error if a kernel page is already mapped to the correct frame
This can happen if one frame contains two loadable sections.
1 parent 9a915f1 commit f317b0d
Copy full SHA for f317b0d

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+9
-2
lines changed

‎src/page_table.rs

Copy file name to clipboardExpand all lines: src/page_table.rs
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,15 @@ pub(crate) fn map_segment(
9696
for frame in PhysFrame::range_inclusive(start_frame, end_frame) {
9797
let offset = frame - start_frame;
9898
let page = start_page + offset;
99-
unsafe { map_page(page, frame, page_table_flags, page_table, frame_allocator)? }
100-
.flush();
99+
match unsafe {
100+
map_page(page, frame, page_table_flags, page_table, frame_allocator)
101+
} {
102+
Ok(flusher) => flusher.flush(),
103+
Err(MapToError::PageAlreadyMapped(to)) if to == frame => {
104+
// nothing to do, page is already mapped to the correct frame
105+
}
106+
Err(err) => return Err(err),
107+
}
101108
}
102109

103110
if mem_size > file_size {

0 commit comments

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