FreeBSD/sys/powerpc/aim/mmu_oea64.c
/*
 * Clear the write and modified bits in each of the given page's mappings.
 */
Clear the write and modified bits in each of the given page's mappings.
Clear the write and modified bits in each of the given page ' s mappings .
void
moea64_remove_write(mmu_t mmu, vm_page_t m)
{
	struct	pvo_entry *pvo;
	int64_t	refchg, ret;
	pmap_t	pmap;
	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
	    ("moea64_remove_write: page %p is not managed", m));
	VM_OBJECT_ASSERT_WLOCKED(m->object);
	if (!vm_page_xbusied(m) && (m->aflags & PGA_WRITEABLE) == 0)
		return;
	powerpc_sync();
	PV_PAGE_LOCK(m);
	refchg = 0;
	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
		pmap = pvo->pvo_pmap;
		PMAP_LOCK(pmap);
		if (!(pvo->pvo_vaddr & PVO_DEAD) &&
		    (pvo->pvo_pte.prot & VM_PROT_WRITE)) {
			pvo->pvo_pte.prot &= ~VM_PROT_WRITE;
			ret = MOEA64_PTE_REPLACE(mmu, pvo,
			    MOEA64_PTE_PROT_UPDATE);
			if (ret < 0)
				ret = LPTE_CHG;
			refchg |= ret;
			if (pvo->pvo_pmap == kernel_pmap)
				isync();
		}
		PMAP_UNLOCK(pmap);
	}
	if ((refchg | atomic_readandclear_32(&m->md.mdpg_attrs)) & LPTE_CHG)
		vm_page_dirty(m);
	vm_page_aflag_clear(m, PGA_WRITEABLE);
	PV_PAGE_UNLOCK(m);
}
void moea64_remove_write ( mmu_t mmu , vm_page_t m ) { struct pvo_entry * pvo ; int64_t refchg , ret ; pmap_t pmap ; KASSERT ( ( m -> oflags & VPO_UNMANAGED ) == 0 , ( " " , m ) ) ; VM_OBJECT_ASSERT_WLOCKED ( m -> object ) ; if ( ! vm_page_xbusied ( m ) && ( m -> aflags & PGA_WRITEABLE ) == 0 ) return ; powerpc_sync ( ) ; PV_PAGE_LOCK ( m ) ; refchg = 0 ; LIST_FOREACH ( pvo , vm_page_to_pvoh ( m ) , pvo_vlink ) { pmap = pvo -> pvo_pmap ; PMAP_LOCK ( pmap ) ; if ( ! ( pvo -> pvo_vaddr & PVO_DEAD ) && ( pvo -> pvo_pte . prot & VM_PROT_WRITE ) ) { pvo -> pvo_pte . prot &= ~ VM_PROT_WRITE ; ret = MOEA64_PTE_REPLACE ( mmu , pvo , MOEA64_PTE_PROT_UPDATE ) ; if ( ret < 0 ) ret = LPTE_CHG ; refchg |= ret ; if ( pvo -> pvo_pmap == kernel_pmap ) isync ( ) ; } PMAP_UNLOCK ( pmap ) ; } if ( ( refchg | atomic_readandclear_32 ( & m -> md . mdpg_attrs ) ) & LPTE_CHG ) vm_page_dirty ( m ) ; vm_page_aflag_clear ( m , PGA_WRITEABLE ) ; PV_PAGE_UNLOCK ( m ) ; }
Clear the write and modified bits in each of the given page's mappings.
Clear the write and modified bits in each of the given page ' s mappings .
/*
	 * If the page is not exclusive busied, then PGA_WRITEABLE cannot be
	 * set by another thread while the object is locked.  Thus,
	 * if PGA_WRITEABLE is clear, no page table entries need updating.
	 */