FreeBSD/sys/arm64/arm64/pmap.c
/*
 *	Routine:	pmap_extract
 *	Function:
 *		Extract the physical page address associated
 *		with the given map/virtual_address pair.
 */
pmap_extract
Function:
Extract the physical page address associated
with the given map/virtual_address pair.
pmap_extract Function : Extract the physical page address associated with the given map / virtual_address pair .
vm_paddr_t 
pmap_extract(pmap_t pmap, vm_offset_t va)
{
	pt_entry_t *pte, tpte;
	vm_paddr_t pa;
	int lvl;
	pa = 0;
	PMAP_LOCK(pmap);
	pte = pmap_pte(pmap, va, &lvl);
	if (pte != NULL) {
		tpte = pmap_load(pte);
		pa = tpte & ~ATTR_MASK;
		switch(lvl) {
		case 1:
			KASSERT((tpte & ATTR_DESCR_MASK) == L1_BLOCK,
			    ("pmap_extract: Invalid L1 pte found: %lx",
			    tpte & ATTR_DESCR_MASK));
			pa |= (va & L1_OFFSET);
			break;
		case 2:
			KASSERT((tpte & ATTR_DESCR_MASK) == L2_BLOCK,
			    ("pmap_extract: Invalid L2 pte found: %lx",
			    tpte & ATTR_DESCR_MASK));
			pa |= (va & L2_OFFSET);
			break;
		case 3:
			KASSERT((tpte & ATTR_DESCR_MASK) == L3_PAGE,
			    ("pmap_extract: Invalid L3 pte found: %lx",
			    tpte & ATTR_DESCR_MASK));
			pa |= (va & L3_OFFSET);
			break;
		}
	}
	PMAP_UNLOCK(pmap);
	return (pa);
}
vm_paddr_t pmap_extract ( pmap_t pmap , vm_offset_t va ) { pt_entry_t * pte , tpte ; vm_paddr_t pa ; int lvl ; pa = 0 ; PMAP_LOCK ( pmap ) ; pte = pmap_pte ( pmap , va , & lvl ) ; if ( pte != NULL ) { tpte = pmap_load ( pte ) ; pa = tpte & ~ ATTR_MASK ; switch ( lvl ) { case 1 : KASSERT ( ( tpte & ATTR_DESCR_MASK ) == L1_BLOCK , ( " " , tpte & ATTR_DESCR_MASK ) ) ; pa |= ( va & L1_OFFSET ) ; break ; case 2 : KASSERT ( ( tpte & ATTR_DESCR_MASK ) == L2_BLOCK , ( " " , tpte & ATTR_DESCR_MASK ) ) ; pa |= ( va & L2_OFFSET ) ; break ; case 3 : KASSERT ( ( tpte & ATTR_DESCR_MASK ) == L3_PAGE , ( " " , tpte & ATTR_DESCR_MASK ) ) ; pa |= ( va & L3_OFFSET ) ; break ; } } PMAP_UNLOCK ( pmap ) ; return ( pa ) ; }
Routine:        pmap_extract
      Function:
              Extract the physical page address associated
              with the given map/virtual_address pair.
Routine : pmap_extract Function : Extract the physical page address associated with the given map / virtual_address pair .
/*
	 * Find the block or page map for this virtual address. pmap_pte
	 * will return either a valid block/page entry, or NULL.
	 */