FreeBSD/sys/arm/arm/pmap-v4.c
/*
 *
 * pmap_modify_pv: Update pv flags
 *
 * => caller should hold lock on vm_page [so that attrs can be adjusted]
 * => caller should NOT adjust pmap's wire_count
 * => we return the old flags
 *
 * Modify a physical-virtual mapping in the pv table
 */
Update pv flags
=> caller should hold lock on vm_page [so that attrs can be adjusted]
=> caller should NOT adjust pmap's wire_count
=> we return the old flags

Modify a physical-virtual mapping in the pv table
Update pv flags = > caller should hold lock on vm_page [ so that attrs can be adjusted ] = > caller should NOT adjust pmap ' s wire_count = > we return the old flags Modify a physical - virtual mapping in the pv table
static u_int
pmap_modify_pv(struct vm_page *pg, pmap_t pm, vm_offset_t va,
    u_int clr_mask, u_int set_mask)
{
	struct pv_entry *npv;
	u_int flags, oflags;
	PMAP_ASSERT_LOCKED(pm);
	rw_assert(&pvh_global_lock, RA_WLOCKED);
	if ((npv = pmap_find_pv(pg, pm, va)) == NULL)
		return (0);
	if (clr_mask & (PVF_REF | PVF_MOD))
		pg->md.pvh_attrs |= set_mask & (PVF_REF | PVF_MOD);
	oflags = npv->pv_flags;
	npv->pv_flags = flags = (oflags & ~clr_mask) | set_mask;
	if ((flags ^ oflags) & PVF_WIRED) {
		if (flags & PVF_WIRED)
			++pm->pm_stats.wired_count;
		else
			--pm->pm_stats.wired_count;
	}
	if ((flags ^ oflags) & PVF_WRITE)
		pmap_fix_cache(pg, pm, 0);
	return (oflags);
}
static u_int pmap_modify_pv ( struct vm_page * pg , pmap_t pm , vm_offset_t va , u_int clr_mask , u_int set_mask ) { struct pv_entry * npv ; u_int flags , oflags ; PMAP_ASSERT_LOCKED ( pm ) ; rw_assert ( & pvh_global_lock , RA_WLOCKED ) ; if ( ( npv = pmap_find_pv ( pg , pm , va ) ) == NULL ) return ( 0 ) ; if ( clr_mask & ( PVF_REF | PVF_MOD ) ) pg -> md . pvh_attrs |= set_mask & ( PVF_REF | PVF_MOD ) ; oflags = npv -> pv_flags ; npv -> pv_flags = flags = ( oflags & ~ clr_mask ) | set_mask ; if ( ( flags ^ oflags ) & PVF_WIRED ) { if ( flags & PVF_WIRED ) ++ pm -> pm_stats . wired_count ; else -- pm -> pm_stats . wired_count ; } if ( ( flags ^ oflags ) & PVF_WRITE ) pmap_fix_cache ( pg , pm , 0 ) ; return ( oflags ) ; }
pmap_modify_pv: Update pv flags
 => caller should hold lock on vm_page [so that attrs can be adjusted]
 => caller should NOT adjust pmap's wire_count
 => we return the old flags
pmap_modify_pv : Update pv flags = > caller should hold lock on vm_page [ so that attrs can be adjusted ] = > caller should NOT adjust pmap ' s wire_count = > we return the old flags
/*
	 * There is at least one VA mapping this page.
	 */