Module Name: src
Committed By: reinoud
Date: Sat Jan 7 19:44:13 UTC 2012
Modified Files:
src/sys/arch/usermode/usermode: pmap.c
Log Message:
Change prototype of logical page number in pv_lookop and pv_enter and add
diagnostic checks to check for out-of-bounds.
To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.97 src/sys/arch/usermode/usermode/pmap.c:1.98
--- src/sys/arch/usermode/usermode/pmap.c:1.97 Thu Jan 5 12:12:58 2012
+++ src/sys/arch/usermode/usermode/pmap.c Sat Jan 7 19:44:13 2012
@@ -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 <[email protected]>
@@ -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 @@ pv_get(pmap_t pmap, uintptr_t ppn, uintp
}
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 @@ if (lpn >= pm_nentries) panic("peeing ou
}
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];