Skip to content

Commit a4f43c8

Browse files
committed
forward map_to_range to map_to_range_with_table_flags by default
1 parent a816ab4 commit a4f43c8

File tree

1 file changed

+11
-17
lines changed
  • src/structures/paging/mapper

1 file changed

+11
-17
lines changed

src/structures/paging/mapper/mod.rs

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -224,24 +224,18 @@ pub trait Mapper<S: PageSize> {
224224
Self: Sized,
225225
A: FrameAllocator<Size4KiB> + ?Sized,
226226
{
227-
assert_eq!(pages.count(), frames.count());
227+
let parent_table_flags = flags
228+
& (PageTableFlags::PRESENT
229+
| PageTableFlags::WRITABLE
230+
| PageTableFlags::USER_ACCESSIBLE);
228231

229-
pages
230-
.zip(frames)
231-
.try_for_each(|(page, frame)| {
232-
self.map_to(page, frame, flags, frame_allocator)
233-
.map(|_| ())
234-
.map_err(|e| {
235-
(
236-
e,
237-
MapperFlushRange::new(PageRange {
238-
start: pages.start,
239-
end: page,
240-
}),
241-
)
242-
})
243-
})
244-
.map(|_| MapperFlushRange::new(pages))
232+
self.map_to_range_with_table_flags(
233+
pages,
234+
frames,
235+
flags,
236+
parent_table_flags,
237+
frame_allocator,
238+
)
245239
}
246240

247241
/// Creates a new mapping in the page table.

0 commit comments

Comments
 (0)