File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/structures/paging/mapper Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -425,6 +425,34 @@ pub trait Mapper<S: PageSize> {
425
425
} )
426
426
}
427
427
428
+ /// Maps frames from the allocator to the given range of virtual pages.
429
+ ///
430
+ /// ## Safety
431
+ ///
432
+ /// This is a convencience function that invokes [`Mapper::map_range_with_table_flags`] internally, so
433
+ /// all safety requirements of it also apply for this function.
434
+ ///
435
+ /// ## Errors
436
+ ///
437
+ /// If an error occurs half-way through a [`MapperFlushRange<S>`] is returned that contains the frames that were successfully mapped.
438
+ #[ inline]
439
+ unsafe fn map_range < A > (
440
+ & mut self ,
441
+ pages : PageRange < S > ,
442
+ flags : PageTableFlags ,
443
+ frame_allocator : & mut A ,
444
+ ) -> Result < MapperFlushRange < S > , ( MapToError < S > , MapperFlushRange < S > ) >
445
+ where
446
+ Self : Sized ,
447
+ A : FrameAllocator < Size4KiB > + FrameAllocator < S > + ?Sized ,
448
+ {
449
+ let parent_table_flags = flags
450
+ & ( PageTableFlags :: PRESENT
451
+ | PageTableFlags :: WRITABLE
452
+ | PageTableFlags :: USER_ACCESSIBLE ) ;
453
+ self . map_range_with_table_flags ( pages, flags, parent_table_flags, frame_allocator)
454
+ }
455
+
428
456
/// Removes a mapping from the page table and returns the frame that used to be mapped.
429
457
///
430
458
/// Note that no page tables or pages are deallocated.
You can’t perform that action at this time.
0 commit comments