Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode/usermode Change prototype of logical page ...



details:   https://anonhg.NetBSD.org/src/rev/abbf6beb71d8
branches:  trunk
changeset: 772542:abbf6beb71d8
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Sat Jan 07 19:44:13 2012 +0000

description:
Change prototype of logical page number in pv_lookop and pv_enter and add
diagnostic checks to check for out-of-bounds.

diffstat:

 sys/arch/usermode/usermode/pmap.c |  22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diffs (60 lines):

diff -r 17ecfe0bc63d -r abbf6beb71d8 sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Sat Jan 07 19:43:06 2012 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Sat Jan 07 19:44:13 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.97 2012/01/05 12:12:58 jmcneill Exp $ */
+/* $NetBSD: pmap.c,v 1.98 2012/01/07 19:44:13 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <reinoud%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97 2012/01/05 12:12:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.98 2012/01/07 19:44:13 reinoud Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -595,13 +595,18 @@
 }
 
 static void
-pmap_set_pv(pmap_t pmap, uint lpn, struct pv_entry *pv)
+pmap_set_pv(pmap_t pmap, uintptr_t lpn, struct pv_entry *pv)
 {
        struct pmap_l2 *l2tbl;
        int l1 = lpn / PMAP_L2_NENTRY;
        int l2 = lpn % PMAP_L2_NENTRY;
 
-if (lpn >= pm_nentries) panic("peeing outside box\n");
+#ifdef DIAGNOSTIC
+       if (lpn >= pm_nentries)
+               panic("peeing outside box : addr in page around %"PRIx64"\n",
+                       (uint64_t) lpn*PAGE_SIZE);
+#endif
+
        l2tbl = pmap->pm_l1[l1];
        if (!l2tbl) {
                l2tbl = pmap->pm_l1[l1] = pool_get(&pmap_l2_pool, PR_WAITOK);
@@ -611,13 +616,18 @@
 }
 
 static struct pv_entry *
-pmap_lookup_pv(pmap_t pmap, uint lpn)
+pmap_lookup_pv(pmap_t pmap, uintptr_t lpn)
 {
        struct pmap_l2 *l2tbl;
        int l1 = lpn / PMAP_L2_NENTRY;
        int l2 = lpn % PMAP_L2_NENTRY;
 
-if (lpn >= pm_nentries) panic("peeing outside box\n");
+#ifdef DIAGNOSTIC
+       if (lpn >= pm_nentries)
+               panic("peeing outside box : addr in page around %"PRIx64"\n",
+                       (uint64_t) lpn*PAGE_SIZE);
+#endif
+
        l2tbl = pmap->pm_l1[l1];
        if (l2tbl)
                return l2tbl->pm_l2[l2];



Home | Main Index | Thread Index | Old Index