FreeBSD/sys/powerpc/aim/mmu_oea.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
moea_remove_write(mmu_t mmu, vm_page_t m)
{
	struct	pvo_entry *pvo;
	struct	pte *pt;
	pmap_t	pmap;
	u_int	lo;
	KASSERT((m->oflags & VPO_UNMANAGED) == 0,
	    ("moea_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;
	rw_wlock(&pvh_global_lock);
	lo = moea_attr_fetch(m);
	powerpc_sync();
	LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) {
		pmap = pvo->pvo_pmap;
		PMAP_LOCK(pmap);
		if ((pvo->pvo_pte.pte.pte_lo & PTE_PP) != PTE_BR) {
			pt = moea_pvo_to_pte(pvo, -1);
			pvo->pvo_pte.pte.pte_lo &= ~PTE_PP;
			pvo->pvo_pte.pte.pte_lo |= PTE_BR;
			if (pt != NULL) {
				moea_pte_synch(pt, &pvo->pvo_pte.pte);
				lo |= pvo->pvo_pte.pte.pte_lo;
				pvo->pvo_pte.pte.pte_lo &= ~PTE_CHG;
				moea_pte_change(pt, &pvo->pvo_pte.pte,
				    pvo->pvo_vaddr);
				mtx_unlock(&moea_table_mutex);
			}
		}
		PMAP_UNLOCK(pmap);
	}
	if ((lo & PTE_CHG) != 0) {
		moea_attr_clear(m, PTE_CHG);
		vm_page_dirty(m);
	}
	vm_page_aflag_clear(m, PGA_WRITEABLE);
	rw_wunlock(&pvh_global_lock);
}
void moea_remove_write ( mmu_t mmu , vm_page_t m ) { struct pvo_entry * pvo ; struct pte * pt ; pmap_t pmap ; u_int lo ; KASSERT ( ( m -> oflags & VPO_UNMANAGED ) == 0 , ( " " , m ) ) ; VM_OBJECT_ASSERT_WLOCKED ( m -> object ) ; if ( ! vm_page_xbusied ( m ) && ( m -> aflags & PGA_WRITEABLE ) == 0 ) return ; rw_wlock ( & pvh_global_lock ) ; lo = moea_attr_fetch ( m ) ; powerpc_sync ( ) ; LIST_FOREACH ( pvo , vm_page_to_pvoh ( m ) , pvo_vlink ) { pmap = pvo -> pvo_pmap ; PMAP_LOCK ( pmap ) ; if ( ( pvo -> pvo_pte . pte . pte_lo & PTE_PP ) != PTE_BR ) { pt = moea_pvo_to_pte ( pvo , -1 ) ; pvo -> pvo_pte . pte . pte_lo &= ~ PTE_PP ; pvo -> pvo_pte . pte . pte_lo |= PTE_BR ; if ( pt != NULL ) { moea_pte_synch ( pt , & pvo -> pvo_pte . pte ) ; lo |= pvo -> pvo_pte . pte . pte_lo ; pvo -> pvo_pte . pte . pte_lo &= ~ PTE_CHG ; moea_pte_change ( pt , & pvo -> pvo_pte . pte , pvo -> pvo_vaddr ) ; mtx_unlock ( & moea_table_mutex ) ; } } PMAP_UNLOCK ( pmap ) ; } if ( ( lo & PTE_CHG ) != 0 ) { moea_attr_clear ( m , PTE_CHG ) ; vm_page_dirty ( m ) ; } vm_page_aflag_clear ( m , PGA_WRITEABLE ) ; rw_wunlock ( & pvh_global_lock ) ; }
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.
	 */