zircon/kernel/arch/x86/page_tables/page_tables.cc
// Base case of AddMapping for smallest page size.
Base case of AddMapping for smallest page size.
Base case of AddMapping for smallest page size .
zx_status_t X86PageTableBase::AddMappingL0(volatile pt_entry_t* table, uint mmu_flags,
                                           const MappingCursor& start_cursor,
                                           MappingCursor* new_cursor, ConsistencyManager* cm) {
  DEBUG_ASSERT(IS_PAGE_ALIGNED(start_cursor.size));
  *new_cursor = start_cursor;
  PtFlags term_flags = terminal_flags(PT_L, mmu_flags);
  uint index = vaddr_to_index(PT_L, new_cursor->vaddr);
  for (; index != NO_OF_PT_ENTRIES && new_cursor->size != 0; ++index) {
    volatile pt_entry_t* e = table + index;
    if (IS_PAGE_PRESENT(*e)) {
      return ZX_ERR_ALREADY_EXISTS;
    }
    UpdateEntry(cm, PT_L, new_cursor->vaddr, e, new_cursor->paddr, term_flags,
                false );
    new_cursor->paddr += PAGE_SIZE;
    new_cursor->vaddr += PAGE_SIZE;
    new_cursor->size -= PAGE_SIZE;
    DEBUG_ASSERT(new_cursor->size <= start_cursor.size);
  }
  return ZX_OK;
}
zx_status_t X86PageTableBase :: AddMappingL0 ( volatile pt_entry_t * table , uint mmu_flags , const MappingCursor & start_cursor , MappingCursor * new_cursor , ConsistencyManager * cm ) { DEBUG_ASSERT ( IS_PAGE_ALIGNED ( start_cursor . size ) ) ; * new_cursor = start_cursor ; PtFlags term_flags = terminal_flags ( PT_L , mmu_flags ) ; uint index = vaddr_to_index ( PT_L , new_cursor -> vaddr ) ; for ( ; index != NO_OF_PT_ENTRIES && new_cursor -> size != 0 ; ++ index ) { volatile pt_entry_t * e = table + index ; if ( IS_PAGE_PRESENT ( * e ) ) { return ZX_ERR_ALREADY_EXISTS ; } UpdateEntry ( cm , PT_L , new_cursor -> vaddr , e , new_cursor -> paddr , term_flags , false ) ; new_cursor -> paddr += PAGE_SIZE ; new_cursor -> vaddr += PAGE_SIZE ; new_cursor -> size -= PAGE_SIZE ; DEBUG_ASSERT ( new_cursor -> size <= start_cursor . size ) ; } return ZX_OK ; }
Base case of AddMapping for smallest page size.
Base case of AddMapping for smallest page size .
/* was_terminal */