Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 Simplify pmap_alloc_level. It is designed t...
details: https://anonhg.NetBSD.org/src/rev/4a57477ef461
branches: trunk
changeset: 346623:4a57477ef461
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Jul 22 13:01:43 2016 +0000
description:
Simplify pmap_alloc_level. It is designed to work only with normal_pdes and
PTP_LEVELS, so don't pass them as argument. While here, explain what we are
doing.
diffstat:
sys/arch/x86/x86/pmap.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diffs (85 lines):
diff -r 76aafc77626d -r 4a57477ef461 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Fri Jul 22 12:55:34 2016 +0000
+++ b/sys/arch/x86/x86/pmap.c Fri Jul 22 13:01:43 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.214 2016/07/22 12:36:03 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.215 2016/07/22 13:01:43 maxv Exp $ */
/*-
* Copyright (c) 2008, 2010, 2016 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.214 2016/07/22 12:36:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.215 2016/07/22 13:01:43 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -569,7 +569,7 @@
vaddr_t, struct pv_entry **);
static paddr_t pmap_get_physpage(void);
-static void pmap_alloc_level(pd_entry_t * const *, vaddr_t, int, long *);
+static void pmap_alloc_level(vaddr_t, long *);
static bool pmap_reactivate(struct pmap *);
@@ -4299,15 +4299,15 @@
}
/*
- * Allocate the amount of specified ptps for a ptp level, and populate
- * all levels below accordingly, mapping virtual addresses starting at
- * kva.
+ * Expand the page tree with the specified amount of PTPs, mapping virtual
+ * addresses starting at kva. We populate all the levels but the last one
+ * (L1). The nodes of the tree are created as RWX, but the pages covered
+ * will be kentered in L1, with proper permissions.
*
- * Used by pmap_growkernel.
+ * Used only by pmap_growkernel.
*/
static void
-pmap_alloc_level(pd_entry_t * const *pdes, vaddr_t kva, int lvl,
- long *needed_ptps)
+pmap_alloc_level(vaddr_t kva, long *needed_ptps)
{
unsigned long i;
paddr_t pa;
@@ -4318,11 +4318,11 @@
int s = splvm(); /* protect xpq_* */
#endif
- for (level = lvl; level > 1; level--) {
+ for (level = PTP_LEVELS; level > 1; level--) {
if (level == PTP_LEVELS)
pdep = pmap_kernel()->pm_pdir;
else
- pdep = pdes[level - 2];
+ pdep = normal_pdes[level - 2];
index = pl_i_roundup(kva, level);
endindex = index + needed_ptps[level - 1] - 1;
@@ -4370,10 +4370,10 @@
}
/*
- * pmap_growkernel: increase usage of KVM space
+ * pmap_growkernel: increase usage of KVM space.
*
* => we allocate new PTPs for the kernel and install them in all
- * the pmaps on the system.
+ * the pmaps on the system.
*/
vaddr_t
@@ -4413,7 +4413,7 @@
needed_kptp[i] = target_nptp - nkptp[i];
}
- pmap_alloc_level(normal_pdes, pmap_maxkvaddr, PTP_LEVELS, needed_kptp);
+ pmap_alloc_level(pmap_maxkvaddr, needed_kptp);
/*
* If the number of top level entries changed, update all pmaps.
Home |
Main Index |
Thread Index |
Old Index