Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 Fix a bug in pmap_modify_pv where we didn...



details:   https://anonhg.NetBSD.org/src/rev/992b32b63b28
branches:  trunk
changeset: 783876:992b32b63b28
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Jan 11 12:04:00 2013 +0000

description:
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.

diffstat:

 sys/arch/arm/arm32/pmap.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (62 lines):

diff -r fede43aef91a -r 992b32b63b28 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Fri Jan 11 12:03:03 2013 +0000
+++ b/sys/arch/arm/arm32/pmap.c Fri Jan 11 12:04:00 2013 +0000
@@ -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 @@
                }
        }
 #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 @@
                                        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 @@
         */
        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 @@
                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



Home | Main Index | Thread Index | Old Index