Skip to content

Commit 331815b

Browse files
committed
forward map_to_range to map_to_range_with_table_flags by default
1 parent 09b1a21 commit 331815b

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
@@ -222,24 +222,18 @@ pub trait Mapper<S: PageSize> {
222222
Self: Sized,
223223
A: FrameAllocator<Size4KiB> + ?Sized,
224224
{
225-
assert_eq!(pages.count(), frames.count());
225+
let parent_table_flags = flags
226+
& (PageTableFlags::PRESENT
227+
| PageTableFlags::WRITABLE
228+
| PageTableFlags::USER_ACCESSIBLE);
226229

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

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

0 commit comments

Comments
 (0)