FreeBSD/sys/arm/arm/pmap-v6.c
/*
 *  If the given pmap is not the current or kernel pmap, the returned
 *  pte2 must be released by passing it to pmap_pte2_release().
 */
If the given pmap is not the current or kernel pmap, the returned
pte2 must be released by passing it to pmap_pte2_release().
If the given pmap is not the current or kernel pmap the returned pte2 must be released by passing it to pmap_pte2_release () .
static pt2_entry_t *
pmap_pte2(pmap_t pmap, vm_offset_t va)
{
	pt1_entry_t pte1;
	vm_paddr_t pt2pg_pa;
	pte1 = pte1_load(pmap_pte1(pmap, va));
	if (pte1_is_section(pte1))
		panic("%s: attempt to map PTE1", __func__);
	if (pte1_is_link(pte1)) {
		if (pmap_is_current(pmap))
			return (pt2map_entry(va));
		pt2pg_pa = trunc_page(pte1_link_pa(pte1));
		mtx_lock(&PMAP2mutex);
		if (pte2_pa(pte2_load(PMAP2)) != pt2pg_pa) {
			pte2_store(PMAP2, PTE2_KPT(pt2pg_pa));
			tlb_flush((vm_offset_t)PADDR2);
		}
		return (PADDR2 + (arm32_btop(va) & (NPTE2_IN_PG - 1)));
	}
	return (NULL);
}
static pt2_entry_t * pmap_pte2 ( pmap_t pmap , vm_offset_t va ) { pt1_entry_t pte1 ; vm_paddr_t pt2pg_pa ; pte1 = pte1_load ( pmap_pte1 ( pmap , va ) ) ; if ( pte1_is_section ( pte1 ) ) panic ( " " , __func__ ) ; if ( pte1_is_link ( pte1 ) ) { if ( pmap_is_current ( pmap ) ) return ( pt2map_entry ( va ) ) ; pt2pg_pa = trunc_page ( pte1_link_pa ( pte1 ) ) ; mtx_lock ( & PMAP2mutex ) ; if ( pte2_pa ( pte2_load ( PMAP2 ) ) != pt2pg_pa ) { pte2_store ( PMAP2 , PTE2_KPT ( pt2pg_pa ) ) ; tlb_flush ( ( vm_offset_t ) PADDR2 ) ; } return ( PADDR2 + ( arm32_btop ( va ) & ( NPTE2_IN_PG - 1 ) ) ) ; } return ( NULL ) ; }
If the given pmap is not the current or kernel pmap, the returned
  pte2 must be released by passing it to pmap_pte2_release().
If the given pmap is not the current or kernel pmap the returned pte2 must be released by passing it to pmap_pte2_release () .
/* Are we current address space or kernel? */ /* Note that L2 page table size is not equal to PAGE_SIZE. */