FreeBSD/sys/i386/i386/pmap.c
/*
 * If the given pmap is not the current or kernel pmap, the returned pte must
 * be released by passing it to pmap_pte_release().
 */
If the given pmap is not the current or kernel pmap, the returned pte must
be released by passing it to pmap_pte_release().
If the given pmap is not the current or kernel pmap the returned pte must be released by passing it to pmap_pte_release () .
pt_entry_t *
pmap_pte(pmap_t pmap, vm_offset_t va)
{
	pd_entry_t newpf;
	pd_entry_t *pde;
	pde = pmap_pde(pmap, va);
	if (*pde & PG_PS)
		return (pde);
	if (*pde != 0) {
		if (pmap_is_current(pmap))
			return (vtopte(va));
		mtx_lock(&PMAP2mutex);
		newpf = *pde & PG_FRAME;
		if ((*PMAP2 & PG_FRAME) != newpf) {
			*PMAP2 = newpf | PG_RW | PG_V | PG_A | PG_M;
			pmap_invalidate_page(kernel_pmap, (vm_offset_t)PADDR2);
		}
		return (PADDR2 + (i386_btop(va) & (NPTEPG - 1)));
	}
	return (NULL);
}
pt_entry_t * pmap_pte ( pmap_t pmap , vm_offset_t va ) { pd_entry_t newpf ; pd_entry_t * pde ; pde = pmap_pde ( pmap , va ) ; if ( * pde & PG_PS ) return ( pde ) ; if ( * pde != 0 ) { if ( pmap_is_current ( pmap ) ) return ( vtopte ( va ) ) ; mtx_lock ( & PMAP2mutex ) ; newpf = * pde & PG_FRAME ; if ( ( * PMAP2 & PG_FRAME ) != newpf ) { * PMAP2 = newpf | PG_RW | PG_V | PG_A | PG_M ; pmap_invalidate_page ( kernel_pmap , ( vm_offset_t ) PADDR2 ) ; } return ( PADDR2 + ( i386_btop ( va ) & ( NPTEPG - 1 ) ) ) ; } return ( NULL ) ; }
If the given pmap is not the current or kernel pmap, the returned pte must
 be released by passing it to pmap_pte_release().
If the given pmap is not the current or kernel pmap the returned pte must be released by passing it to pmap_pte_release () .
/* are we current address space or kernel? */