FreeBSD/sys/powerpc/aim/mmu_oea64.c
/*
 * Set the physical protection on the specified range of this map as requested.
 */
Set the physical protection on the specified range of this map as requested.
Set the physical protection on the specified range of this map as requested .
static void
moea64_pvo_protect(mmu_t mmu,  pmap_t pm, struct pvo_entry *pvo, vm_prot_t prot)
{
	struct vm_page *pg;
	vm_prot_t oldprot;
	int32_t refchg;
	PMAP_LOCK_ASSERT(pm, MA_OWNED);
	oldprot = pvo->pvo_pte.prot;
	pvo->pvo_pte.prot = prot;
	pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN);
	refchg = MOEA64_PTE_REPLACE(mmu, pvo, MOEA64_PTE_PROT_UPDATE);
	if (refchg < 0)
		refchg = (oldprot & VM_PROT_WRITE) ? LPTE_CHG : 0;
	if (pm != kernel_pmap && pg != NULL && !(pg->aflags & PGA_EXECUTABLE) &&
	    (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) {
		if ((pg->oflags & VPO_UNMANAGED) == 0)
			vm_page_aflag_set(pg, PGA_EXECUTABLE);
		moea64_syncicache(mmu, pm, PVO_VADDR(pvo),
		    pvo->pvo_pte.pa & LPTE_RPGN, PAGE_SIZE);
	}
	if (pg != NULL && (pvo->pvo_vaddr & PVO_MANAGED) &&
	    (oldprot & VM_PROT_WRITE)) {
		refchg |= atomic_readandclear_32(&pg->md.mdpg_attrs);
		if (refchg & LPTE_CHG)
			vm_page_dirty(pg);
		if (refchg & LPTE_REF)
			vm_page_aflag_set(pg, PGA_REFERENCED);
	}
}
static void moea64_pvo_protect ( mmu_t mmu , pmap_t pm , struct pvo_entry * pvo , vm_prot_t prot ) { struct vm_page * pg ; vm_prot_t oldprot ; int32_t refchg ; PMAP_LOCK_ASSERT ( pm , MA_OWNED ) ; oldprot = pvo -> pvo_pte . prot ; pvo -> pvo_pte . prot = prot ; pg = PHYS_TO_VM_PAGE ( pvo -> pvo_pte . pa & LPTE_RPGN ) ; refchg = MOEA64_PTE_REPLACE ( mmu , pvo , MOEA64_PTE_PROT_UPDATE ) ; if ( refchg < 0 ) refchg = ( oldprot & VM_PROT_WRITE ) ? LPTE_CHG : 0 ; if ( pm != kernel_pmap && pg != NULL && ! ( pg -> aflags & PGA_EXECUTABLE ) && ( pvo -> pvo_pte . pa & ( LPTE_I | LPTE_G | LPTE_NOEXEC ) ) == 0 ) { if ( ( pg -> oflags & VPO_UNMANAGED ) == 0 ) vm_page_aflag_set ( pg , PGA_EXECUTABLE ) ; moea64_syncicache ( mmu , pm , PVO_VADDR ( pvo ) , pvo -> pvo_pte . pa & LPTE_RPGN , PAGE_SIZE ) ; } if ( pg != NULL && ( pvo -> pvo_vaddr & PVO_MANAGED ) && ( oldprot & VM_PROT_WRITE ) ) { refchg |= atomic_readandclear_32 ( & pg -> md . mdpg_attrs ) ; if ( refchg & LPTE_CHG ) vm_page_dirty ( pg ) ; if ( refchg & LPTE_REF ) vm_page_aflag_set ( pg , PGA_REFERENCED ) ; } }
Set the physical protection on the specified range of this map as requested.
Set the physical protection on the specified range of this map as requested .
/*
	 * Change the protection of the page.
	 */ /*
	 * If the PVO is in the page table, update mapping
	 */ /*
	 * Update vm about the REF/CHG bits if the page is managed and we have
	 * removed write access.
	 */