Module Name:    src
Committed By:   matt
Date:           Fri Jan 11 12:04:01 UTC 2013

Modified Files:
        src/sys/arch/arm/arm32: pmap.c

Log Message:
Fix a bug in pmap_modify_pv where we didn't set PVF_WRITE on a page after
changing its mapping to writeable.
Add more KASSERTS
Don't go into DDB by default in pmap_fixup.


To generate a diff of this commit:
cvs rdiff -u -r1.246 -r1.247 src/sys/arch/arm/arm32/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.246 src/sys/arch/arm/arm32/pmap.c:1.247
--- src/sys/arch/arm/arm32/pmap.c:1.246	Tue Dec 11 23:51:34 2012
+++ src/sys/arch/arm/arm32/pmap.c	Fri Jan 11 12:04:00 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.246 2012/12/11 23:51:34 matt Exp $	*/
+/*	$NetBSD: pmap.c,v 1.247 2013/01/11 12:04:00 matt Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
 #include <arm/cpuconf.h>
 #include <arm/arm32/katelib.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.246 2012/12/11 23:51:34 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.247 2013/01/11 12:04:00 matt Exp $");
 
 #ifdef PMAP_DEBUG
 
@@ -1087,8 +1087,11 @@ pmap_modify_pv(struct vm_page_md *md, pa
 		}
 	}
 #ifdef PMAP_CACHE_VIPT
-	if (md->urw_mappings + md->krw_mappings == 0)
+	if (md->urw_mappings + md->krw_mappings == 0) {
 		md->pvh_attrs &= ~PVF_WRITE;
+	} else {
+		md->pvh_attrs |= PVF_WRITE;
+	}
 	/*
 	 * We have two cases here: the first is from enter_pv (new exec
 	 * page), the second is a combined pmap_remove_pv/pmap_enter_pv.
@@ -2224,8 +2227,11 @@ pmap_clearbit(struct vm_page_md *md, pad
 					md->uro_mappings++;
 				}
 #ifdef PMAP_CACHE_VIPT
-				if (md->urw_mappings + md->krw_mappings == 0)
+				if (md->urw_mappings + md->krw_mappings == 0) {
 					md->pvh_attrs &= ~PVF_WRITE;
+				} else {
+					KASSERT(md->pvh_attrs & PVF_WRITE);
+				}
 				if (want_syncicache)
 					need_syncicache = true;
 				need_vac_me_harder = true;
@@ -4043,6 +4049,7 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, 
 	 */
 	if (rv == 0 && pm->pm_l1->l1_domain_use_count == 1) {
 		extern int last_fault_code;
+		extern int kernel_debug;
 		printf("fixup: pm %p, va 0x%lx, ftype %d - nothing to do!\n",
 		    pm, va, ftype);
 		printf("fixup: l2 %p, l2b %p, ptep %p, pl1pd %p\n",
@@ -4050,7 +4057,8 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, 
 		printf("fixup: pte 0x%x, l1pd 0x%x, last code 0x%x\n",
 		    pte, l1pd, last_fault_code);
 #ifdef DDB
-		Debugger();
+		if (kernel_debug & 2)
+			Debugger();
 #endif
 	}
 #endif

Reply via email to