fn map_to_1gib<A>(
        &mut self,
        page: Page<Size1GiB>,
        frame: PhysFrame<Size1GiB>,
        flags: PageTableFlags,
        attr: PageTableAttribute,
        allocator: &mut A,
    ) -> Result<MapperFlush<Size1GiB>, MapToError>
    where
        A: FrameAllocator<Size4KiB>,
    {
        let p4 = &mut self.level_4_table;
        let p3 = self
            .page_table_walker
            .create_next_table(&mut p4[page.p4_index()], allocator)?;

        if !p3[page.p3_index()].is_unused() {
            return Err(MapToError::PageAlreadyMapped);
        }
        p3[page.p3_index()].set_block::<Size1GiB>(frame.start_address(), flags, attr);

        Ok(MapperFlush::new(page))
    }
/// Helper function for implementing Mapper. Safe to limit the scope of unsafe, see
/// https://github.com/rust-lang/rfcs/pull/2585.
Helper function for implementing Mapper.
Helper function for implementing Mapper .
fn map_to_1gib<A>(
        &mut self,
        page: Page<Size1GiB>,
        frame: PhysFrame<Size1GiB>,
        flags: PageTableFlags,
        attr: PageTableAttribute,
        allocator: &mut A,
    ) -> Result<MapperFlush<Size1GiB>, MapToError>
    where
        A: FrameAllocator<Size4KiB>,
    {
        let p4 = &mut self.level_4_table;
        let p3 = self
            .page_table_walker
            .create_next_table(&mut p4[page.p4_index()], allocator)?;
        if !p3[page.p3_index()].is_unused() {
            return Err(MapToError::PageAlreadyMapped);
        }
        p3[page.p3_index()].set_block::<Size1GiB>(frame.start_address(), flags, attr);
        Ok(MapperFlush::new(page))
    }
fn map_to_1gib < A > ( & mut self , page : Page < Size1GiB > , frame : PhysFrame < Size1GiB > , flags : PageTableFlags , attr : PageTableAttribute , allocator : & mut A , ) -> Result < MapperFlush < Size1GiB > , MapToError > where A : FrameAllocator < Size4KiB > , { let p4 = & mut self . level_4_table ; let p3 = self . page_table_walker . create_next_table ( & mut p4 [ page . p4_index ( ) ] , allocator ) ? ; if ! p3 [ page . p3_index ( ) ] . is_unused ( ) { return Err ( MapToError :: PageAlreadyMapped ) ; } p3 [ page . p3_index ( ) ] . set_block :: < Size1GiB > ( frame . start_address ( ) , flags , attr ) ; Ok ( MapperFlush :: new ( page ) ) }
Helper function for implementing Mapper.
Helper function for implementing Mapper .
&mut self
page
Page<Size1GiB>
frame
PhysFrame<Size1GiB>
flags
PageTableFlags
attr
PageTableAttribute
allocator
&mut A