FreeBSD/sys/arm/arm/pmap-v6.c
/*
 *  Do the things to protect a 1mpage in a process.
 */
Do the things to protect a 1mpage in a process.
Do the things to protect a 1mpage in a process .
static void
pmap_protect_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_offset_t sva,
    vm_prot_t prot)
{
	pt1_entry_t npte1, opte1;
	vm_offset_t eva, va;
	vm_page_t m;
	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
	KASSERT((sva & PTE1_OFFSET) == 0,
	    ("%s: sva is not 1mpage aligned", __func__));
	opte1 = npte1 = pte1_load(pte1p);
	if (pte1_is_managed(opte1)) {
		eva = sva + PTE1_SIZE;
		for (va = sva, m = PHYS_TO_VM_PAGE(pte1_pa(opte1));
		    va < eva; va += PAGE_SIZE, m++)
			if (pte1_is_dirty(opte1))
				vm_page_dirty(m);
	}
	if ((prot & VM_PROT_WRITE) == 0)
		npte1 |= PTE1_RO | PTE1_NM;
	if ((prot & VM_PROT_EXECUTE) == 0)
		npte1 |= PTE1_NX;
	if (npte1 != opte1) {
		pte1_store(pte1p, npte1);
		pmap_tlb_flush(pmap, sva);
	}
}
static void pmap_protect_pte1 ( pmap_t pmap , pt1_entry_t * pte1p , vm_offset_t sva , vm_prot_t prot ) { pt1_entry_t npte1 , opte1 ; vm_offset_t eva , va ; vm_page_t m ; PMAP_LOCK_ASSERT ( pmap , MA_OWNED ) ; KASSERT ( ( sva & PTE1_OFFSET ) == 0 , ( " " , __func__ ) ) ; opte1 = npte1 = pte1_load ( pte1p ) ; if ( pte1_is_managed ( opte1 ) ) { eva = sva + PTE1_SIZE ; for ( va = sva , m = PHYS_TO_VM_PAGE ( pte1_pa ( opte1 ) ) ; va < eva ; va += PAGE_SIZE , m ++ ) if ( pte1_is_dirty ( opte1 ) ) vm_page_dirty ( m ) ; } if ( ( prot & VM_PROT_WRITE ) == 0 ) npte1 |= PTE1_RO | PTE1_NM ; if ( ( prot & VM_PROT_EXECUTE ) == 0 ) npte1 |= PTE1_NX ; if ( npte1 != opte1 ) { pte1_store ( pte1p , npte1 ) ; pmap_tlb_flush ( pmap , sva ) ; } }
Do the things to protect a 1mpage in a process.
Do the things to protect a 1mpage in a process .
/*
	 * QQQ: Herein, execute permission is never set.
	 *      It only can be cleared. So, no icache
	 *      syncing is needed.
	 */