FreeBSD/sys/arm64/arm64/pmap.c
/*
 *	pmap_page_wired_mappings:
 *
 *	Return the number of managed mappings to the given physical page
 *	that are wired.
 */
Return the number of managed mappings to the given physical page
that are wired.
Return the number of managed mappings to the given physical page that are wired .
int
pmap_page_wired_mappings(vm_page_t m)
{
	struct rwlock *lock;
	pmap_t pmap;
	pt_entry_t *pte;
	pv_entry_t pv;
	int count, lvl, md_gen;
	if ((m->oflags & VPO_UNMANAGED) != 0)
		return (0);
	rw_rlock(&pvh_global_lock);
	lock = VM_PAGE_TO_PV_LIST_LOCK(m);
	rw_rlock(lock);
restart:
	count = 0;
	TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) {
		pmap = PV_PMAP(pv);
		if (!PMAP_TRYLOCK(pmap)) {
			md_gen = m->md.pv_gen;
			rw_runlock(lock);
			PMAP_LOCK(pmap);
			rw_rlock(lock);
			if (md_gen != m->md.pv_gen) {
				PMAP_UNLOCK(pmap);
				goto restart;
			}
		}
		pte = pmap_pte(pmap, pv->pv_va, &lvl);
		if (pte != NULL && (pmap_load(pte) & ATTR_SW_WIRED) != 0)
			count++;
		PMAP_UNLOCK(pmap);
	}
	rw_runlock(lock);
	rw_runlock(&pvh_global_lock);
	return (count);
}
int pmap_page_wired_mappings ( vm_page_t m ) { struct rwlock * lock ; pmap_t pmap ; pt_entry_t * pte ; pv_entry_t pv ; int count , lvl , md_gen ; if ( ( m -> oflags & VPO_UNMANAGED ) != 0 ) return ( 0 ) ; rw_rlock ( & pvh_global_lock ) ; lock = VM_PAGE_TO_PV_LIST_LOCK ( m ) ; rw_rlock ( lock ) ; restart : count = 0 ; TAILQ_FOREACH ( pv , & m -> md . pv_list , pv_next ) { pmap = PV_PMAP ( pv ) ; if ( ! PMAP_TRYLOCK ( pmap ) ) { md_gen = m -> md . pv_gen ; rw_runlock ( lock ) ; PMAP_LOCK ( pmap ) ; rw_rlock ( lock ) ; if ( md_gen != m -> md . pv_gen ) { PMAP_UNLOCK ( pmap ) ; goto restart ; } } pte = pmap_pte ( pmap , pv -> pv_va , & lvl ) ; if ( pte != NULL && ( pmap_load ( pte ) & ATTR_SW_WIRED ) != 0 ) count ++ ; PMAP_UNLOCK ( pmap ) ; } rw_runlock ( lock ) ; rw_runlock ( & pvh_global_lock ) ; return ( count ) ; }
pmap_page_wired_mappings:
      Return the number of managed mappings to the given physical page
      that are wired.
pmap_page_wired_mappings : Return the number of managed mappings to the given physical page that are wired .