FreeBSD/sys/i386/i386/pmap.c
/*
 * Tries to create a 2- or 4MB page mapping.  Returns TRUE if successful and
 * FALSE otherwise.  Fails if (1) a page table page cannot be allocated without
 * blocking, (2) a mapping already exists at the specified virtual address, or
 * (3) a pv entry cannot be allocated without reclaiming another pv entry. 
 */
Tries to create a 2- or 4MB page mapping.  Returns TRUE if successful and
FALSE otherwise.  Fails if (1) a page table page cannot be allocated without
blocking, (2) a mapping already exists at the specified virtual address, or
(3) a pv entry cannot be allocated without reclaiming another pv entry.
Tries to create a 2 - or 4MB page mapping . Returns TRUE if successful and FALSE otherwise . Fails if ( 1 ) a page table page cannot be allocated without blocking ( 2 ) a mapping already exists at the specified virtual address or ( 3 ) a pv entry cannot be allocated without reclaiming another pv entry .
static boolean_t
pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
{
	pd_entry_t *pde, newpde;
	rw_assert(&pvh_global_lock, RA_WLOCKED);
	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
	pde = pmap_pde(pmap, va);
	if (*pde != 0) {
		CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx"
		    " in pmap %p", va, pmap);
		return (FALSE);
	}
	newpde = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 1) |
	    PG_PS | PG_V;
	if ((m->oflags & VPO_UNMANAGED) == 0) {
		newpde |= PG_MANAGED;
		if (!pmap_pv_insert_pde(pmap, va, VM_PAGE_TO_PHYS(m))) {
			CTR2(KTR_PMAP, "pmap_enter_pde: failure for va %#lx"
			    " in pmap %p", va, pmap);
			return (FALSE);
		}
	}
#if defined(PAE) || defined(PAE_TABLES)
	if ((prot & VM_PROT_EXECUTE) == 0)
		newpde |= pg_nx;
#endif
	if (va < VM_MAXUSER_ADDRESS)
		newpde |= PG_U;
	pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE;
	pde_store(pde, newpde);
	pmap_pde_mappings++;
	CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx"
	    " in pmap %p", va, pmap);
	return (TRUE);
}
static boolean_t pmap_enter_pde ( pmap_t pmap , vm_offset_t va , vm_page_t m , vm_prot_t prot ) { pd_entry_t * pde , newpde ; rw_assert ( & pvh_global_lock , RA_WLOCKED ) ; PMAP_LOCK_ASSERT ( pmap , MA_OWNED ) ; pde = pmap_pde ( pmap , va ) ; if ( * pde != 0 ) { CTR2 ( KTR_PMAP , " " " " , va , pmap ) ; return ( FALSE ) ; } newpde = VM_PAGE_TO_PHYS ( m ) | pmap_cache_bits ( m -> md . pat_mode , 1 ) | PG_PS | PG_V ; if ( ( m -> oflags & VPO_UNMANAGED ) == 0 ) { newpde |= PG_MANAGED ; if ( ! pmap_pv_insert_pde ( pmap , va , VM_PAGE_TO_PHYS ( m ) ) ) { CTR2 ( KTR_PMAP , " " " " , va , pmap ) ; return ( FALSE ) ; } } #if defined ( PAE ) || defined ( PAE_TABLES ) if ( ( prot & VM_PROT_EXECUTE ) == 0 ) newpde |= pg_nx ; #endif if ( va < VM_MAXUSER_ADDRESS ) newpde |= PG_U ; pmap -> pm_stats . resident_count += NBPDR / PAGE_SIZE ; pde_store ( pde , newpde ) ; pmap_pde_mappings ++ ; CTR2 ( KTR_PMAP , " " " " , va , pmap ) ; return ( TRUE ) ; }
Tries to create a 2- or 4MB page mapping.
Tries to create a 2 - or 4MB page mapping .
/*
		 * Abort this mapping if its PV entry could not be created.
		 */ /*
	 * Increment counters.
	 */ /*
	 * Map the superpage.
	 */