Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Mar 2007 12:56:39 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 116413 for review
Message-ID:  <200703231256.l2NCudh0063317@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116413

Change 116413 by gonzo@gonzo_jeeves on 2007/03/23 12:56:32

	o Implement pmap_page_protect.

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips/pmap.c#24 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips/pmap.c#24 (text+ko) ====

@@ -1575,12 +1575,31 @@
 void
 pmap_page_protect(vm_page_t m, vm_prot_t prot)
 {
+	pv_entry_t pv, npv;
+	vm_offset_t va;
+	pt_entry_t *pte;
+
 	/* 
 	 * Consider only readonly case
 	 */
 	if ((prot & VM_PROT_WRITE) == 0) {
 		if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) {
-			panic("pmap_page_protect unimplemented\n");
+			/*
+			 * Loop over all current mappings 
+			 * setting/clearing as appropos.
+			 */
+			for(pv = TAILQ_FIRST(&m->md.pv_list); pv; pv = npv) {
+				npv = TAILQ_NEXT(pv, pv_plist);
+				pte = pmap_pte(pv->pv_pmap, pv->pv_va);
+		
+				if ((pte == NULL) || !pte_valid(pte))
+					panic("page on pm_pvlist has no pte\n");
+
+				va = pv->pv_va;
+				pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE,
+				    prot);
+
+                        }
 		} else {
 			pmap_remove_all(m);
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703231256.l2NCudh0063317>