Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Dec 2006 18:57:46 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 111907 for review
Message-ID:  <200612181857.kBIIvkPD010024@repoman.freebsd.org>

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

Change 111907 by gonzo@gonzo_hq on 2006/12/18 18:56:53

	o Clean out pmap_pte_XXX bits checking macroses, use those
	    presented in pte.h header file.
	o Brace sensitve section of pmap_protect with 
	    vm_page_lock_queues/vm_page_unlock_queues calls.

Affected files ...

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

Differences ...

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

@@ -105,6 +105,7 @@
 #include <machine/cache.h>
 #include <machine/locore.h>
 #include <machine/md_var.h>
+#include <machine/pte.h>
 #include <machine/tlb.h>
 
 #ifndef PMAP_SHPGPERPROC
@@ -133,21 +134,9 @@
 /*
  * Get PDEs and PTEs for user/kernel address space
  */
-#define	pmap_pte_ro(pte)	((*(pte) & PG_RO) != 0)
-#define pmap_pte_w(pte)		((*(pte) & PG_W) != 0)
-#define pmap_pte_v(pte)		((*(pte) & PG_V) != 0)
-#define pmap_pte_pa(pte)	(MIPS_PTE_TO_PA(*(pte)))
-#define pmap_pte_prot(pte)	(*(pte) & PG_PROT)
-
-#define pmap_pte_set_prot(pte, v) ((*pte &= ~PG_PROT), (*pte |= (v)))
-
-/*
- * Given a map and a machine independent protection code,
- * convert to a mips protection code.
- *
- * XXX
- */
-#define pte_prot(m, p)		(0)
+#define	pmap_pte_pa(pte)	(MIPS_PTE_TO_PA(*(pte)))
+#define	pmap_pte_prot(pte)	(*(pte) & PG_PROT)
+#define	pmap_pte_set_prot(pte, v) ((*pte &= ~PG_PROT), (*pte |= (v)))
 
 /*
  * Return non-zero if this pmap is currently active
@@ -210,6 +199,14 @@
 		vm_page_t mpte, vm_page_t m);
 
 /*
+ * Given a map and a machine independent protection code,
+ * convert to a mips protection code.
+ *
+ * XXX
+ */
+#define pte_prot(m, p)			(0)
+
+/*
  * 	Routine:	pmap_pte
  * 	Function:
  * 		Extract the page table entry associated with
@@ -1117,7 +1114,7 @@
 		 * If pte is invalid, skip this page
 		 */
 		pte = pmap_pte(pmap, sva);
-		if (!pmap_pte_v(pte)) {
+		if (!pte_valid(pte)) {
 			sva += PAGE_SIZE;
 			continue;
 		}
@@ -1125,6 +1122,8 @@
 		if (pmap_pte_prot(pte) != newprot) {
 			pt_entry_t oldpte = *pte;
 			vm_page_t m = NULL;
+
+			vm_page_lock_queues();
 			if ((oldpte & PG_D) == 0) {
 				m = PHYS_TO_VM_PAGE(pmap_pte_pa(pte));
 				vm_page_flag_set(m, PG_REFERENCED);
@@ -1139,6 +1138,7 @@
 			oldpte = (oldpte & ~PG_PROT) | newprot;
 			*pte = oldpte;
 			pmap_invalidate_page(pmap, sva);
+			vm_page_unlock_queues();
 		}
 
 		sva += PAGE_SIZE;
@@ -1498,7 +1498,7 @@
 		pv = npv) {
 
 		pte = pmap_pte(pv->pv_pmap, pv->pv_va);
-		if (!pmap_pte_v(pte))
+		if (!pte_valid(pte))
 			panic("pmap_remove_pages: page on pm_pvlist has no pte\n");
 		tpte = *pte;
 
@@ -1541,6 +1541,9 @@
 void
 pmap_page_protect(vm_page_t m, vm_prot_t prot)
 {
+	/* 
+	 * Consider only readonly case
+	 */
 	if ((prot & VM_PROT_WRITE) == 0) {
 		if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) {
 			panic("pmap_page_protect unimplemented\n");
@@ -1729,7 +1732,7 @@
 		return 0;
 	}
 
-	if (pmap_pte_v(pte)) {
+	if (pte_valid(pte)) {
 		vm_page_t m;
 		vm_offset_t pa;
 



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