FreeBSD/sys/arm/arm/pmap-v6.c
/*
 *  Tries to create 1MB 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 1MB 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 1MB 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_pte1(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
{
	pt1_entry_t *pte1p;
	vm_paddr_t pa;
	uint32_t l1prot;
	rw_assert(&pvh_global_lock, RA_WLOCKED);
	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
	pte1p = pmap_pte1(pmap, va);
	if (pte1_is_valid(pte1_load(pte1p))) {
		CTR3(KTR_PMAP, "%s: failure for va %#lx in pmap %p", __func__,
		    va, pmap);
		return (FALSE);
	}
	if ((m->oflags & VPO_UNMANAGED) == 0) {
		if (!pmap_pv_insert_pte1(pmap, va, VM_PAGE_TO_PHYS(m))) {
			CTR3(KTR_PMAP, "%s: failure for va %#lx in pmap %p",
			    __func__, va, pmap);
			return (FALSE);
		}
	}
	pmap->pm_stats.resident_count += PTE1_SIZE / PAGE_SIZE;
	pa = VM_PAGE_TO_PHYS(m);
	l1prot = PTE1_RO | PTE1_NM;
	if (va < VM_MAXUSER_ADDRESS)
		l1prot |= PTE1_U | PTE1_NG;
	if ((prot & VM_PROT_EXECUTE) == 0)
		l1prot |= PTE1_NX;
	else if (m->md.pat_mode == VM_MEMATTR_WB_WA && pmap != kernel_pmap) {
		cache_icache_sync_fresh(va, pa, PTE1_SIZE);
	}
	pte1_store(pte1p, PTE1(pa, l1prot, ATTR_TO_L1(vm_page_pte2_attr(m))));
	pmap_pte1_mappings++;
	CTR3(KTR_PMAP, "%s: success for va %#lx in pmap %p", __func__, va,
	    pmap);
	return (TRUE);
}
static boolean_t pmap_enter_pte1 ( pmap_t pmap , vm_offset_t va , vm_page_t m , vm_prot_t prot ) { pt1_entry_t * pte1p ; vm_paddr_t pa ; uint32_t l1prot ; rw_assert ( & pvh_global_lock , RA_WLOCKED ) ; PMAP_LOCK_ASSERT ( pmap , MA_OWNED ) ; pte1p = pmap_pte1 ( pmap , va ) ; if ( pte1_is_valid ( pte1_load ( pte1p ) ) ) { CTR3 ( KTR_PMAP , " " , __func__ , va , pmap ) ; return ( FALSE ) ; } if ( ( m -> oflags & VPO_UNMANAGED ) == 0 ) { if ( ! pmap_pv_insert_pte1 ( pmap , va , VM_PAGE_TO_PHYS ( m ) ) ) { CTR3 ( KTR_PMAP , " " , __func__ , va , pmap ) ; return ( FALSE ) ; } } pmap -> pm_stats . resident_count += PTE1_SIZE / PAGE_SIZE ; pa = VM_PAGE_TO_PHYS ( m ) ; l1prot = PTE1_RO | PTE1_NM ; if ( va < VM_MAXUSER_ADDRESS ) l1prot |= PTE1_U | PTE1_NG ; if ( ( prot & VM_PROT_EXECUTE ) == 0 ) l1prot |= PTE1_NX ; else if ( m -> md . pat_mode == VM_MEMATTR_WB_WA && pmap != kernel_pmap ) { cache_icache_sync_fresh ( va , pa , PTE1_SIZE ) ; } pte1_store ( pte1p , PTE1 ( pa , l1prot , ATTR_TO_L1 ( vm_page_pte2_attr ( m ) ) ) ) ; pmap_pte1_mappings ++ ; CTR3 ( KTR_PMAP , " " , __func__ , va , pmap ) ; return ( TRUE ) ; }
Tries to create 1MB page mapping.
Tries to create 1MB page mapping .
/*
		 * Abort this mapping if its PV entry could not be created.
		 */ /*
	 * Increment counters.
	 */ /*
	 * Map the section.
	 *
	 * QQQ: Why VM_PROT_WRITE is not evaluated and the mapping is
	 *      made readonly?
	 */ /*
		 * Sync icache if exec permission and attribute VM_MEMATTR_WB_WA
		 * is set. QQQ: For more info, see comments in pmap_enter().
		 */