pub fn next_table_may_create(
        &mut self,
        index: usize,
    ) -> Result<&mut Table<L::NextLevel>, MemoryError> {
        let flags = self.entries[index].flags();
        debug_assert!(!flags.contains(EntryFlags::HUGE_PAGE));

        let addr = self.next_table_address_unchecked(index);
        let table = unsafe { &mut *(addr as *mut Table<L::NextLevel>) };

        // Need to create a table.
        if !flags.contains(EntryFlags::PRESENT) {
            // We could call the page mapping functions here, but it would be slower than
            // manipulating the pmm ourselves.
            with_pmm(|pmm| {
                pmm.pop_top(|top| {
                    // We don't need to invalidate because it wasn't present.
                    self.entries[index].set(top, EntryFlags::PRESENT | EntryFlags::WRITABLE);

                    VirtAddr::new(addr)
                })
            })?;

            self.increase_used_count();

            table.clear();
        }

        Ok(table)
    }
/// Gets the next table (mutable), creates it if it doesn't exist yet.
Gets the next table (mutable), creates it if it doesn't exist yet.
Gets the next table ( mutable ) creates it if it doesn ' t exist yet .
pub fn next_table_may_create(
        &mut self,
        index: usize,
    ) -> Result<&mut Table<L::NextLevel>, MemoryError> {
        let flags = self.entries[index].flags();
        debug_assert!(!flags.contains(EntryFlags::HUGE_PAGE));
        let addr = self.next_table_address_unchecked(index);
        let table = unsafe { &mut *(addr as *mut Table<L::NextLevel>) };
        // Need to create a table.
        if !flags.contains(EntryFlags::PRESENT) {
            // We could call the page mapping functions here, but it would be slower than
            // manipulating the pmm ourselves.
            with_pmm(|pmm| {
                pmm.pop_top(|top| {
                    // We don't need to invalidate because it wasn't present.
                    self.entries[index].set(top, EntryFlags::PRESENT | EntryFlags::WRITABLE);
                    VirtAddr::new(addr)
                })
            })?;
            self.increase_used_count();
            table.clear();
        }
        Ok(table)
    }
pub fn next_table_may_create ( & mut self , index : usize , ) -> Result < & mut Table < L :: NextLevel > , MemoryError > { let flags = self . entries [ index ] . flags ( ) ; debug_assert ! ( flags contains ( EntryFlags HUGE_PAGE ) ) ; let addr = self . next_table_address_unchecked ( index ) ; let table = unsafe { & mut * ( addr as * mut Table < L :: NextLevel > ) } ; // Need to create a table. if ! flags . contains ( EntryFlags :: PRESENT ) { // We could call the page mapping functions here, but it would be slower than // manipulating the pmm ourselves. with_pmm ( | pmm | { pmm . pop_top ( | top | { // We don't need to invalidate because it wasn't present. self . entries [ index ] . set ( top , EntryFlags :: PRESENT | EntryFlags :: WRITABLE ) ; VirtAddr :: new ( addr ) } ) } ) ? ; self . increase_used_count ( ) ; table . clear ( ) ; } Ok ( table ) }
Gets the next table (mutable), creates it if it doesn't exist yet.
Gets the next table ( mutable ) creates it if it doesn ' t exist yet .
&mut self
index
usize
&mut self
index
usize