vm_offset_t sva; vm_offset_t eva;
vaddr_t sva; vaddr_t eva;
pmap_protect(pmap, sva, eva, prot)	pmap_t pmap;	vm_offset_t sva;	vm_offset_t eva;	vm_prot_t prot;{	register struct pv_entry *pv;	u_int tlbprot;	pa_space_t space;#ifdef PMAPDEBUG	if (pmapdebug & PDB_FOLLOW)		printf("pmap_protect(%p, %x, %x, %x)\n", pmap, sva, eva, prot);#endif	if (!pmap)		return;	if (prot == VM_PROT_NONE) {		pmap_remove(pmap, sva, eva);		return;	}	if (prot & VM_PROT_WRITE)		return;	simple_lock(&pmap->pmap_lock);	space = pmap_sid(pmap, sva);		for(; sva < eva; sva += PAGE_SIZE) {		if((pv = pmap_find_va(space, sva))) {			/*			 * Determine if mapping is changing.			 * If not, nothing to do.			 */			tlbprot = pmap_prot(pmap, prot);			if ((pv->pv_tlbprot & TLB_AR_MASK) == tlbprot)				continue;						pv->pv_tlbprot &= ~TLB_AR_MASK;			pv->pv_tlbprot |= tlbprot;						pmap_clear_va(space, pv->pv_va);						/*			 * Purge the current TLB entry (if any) to force			 * a fault and reload with the new protection.			 */			pdtlb(space, pv->pv_va);			pitlb(space, pv->pv_va);		}	}	simple_unlock(&pmap->pmap_lock);}