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