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