Module Name: src
Committed By: maxv
Date: Fri Jul 1 11:57:11 UTC 2016
Modified Files:
src/sys/arch/x86/x86: pmap.c
Log Message:
We use only one L4 slot for the direct map, which means that we cannot
map more than 512GB. Panic properly if this limit is reached.
To generate a diff of this commit:
cvs rdiff -u -r1.202 -r1.203 src/sys/arch/x86/x86/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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.202 src/sys/arch/x86/x86/pmap.c:1.203
--- src/sys/arch/x86/x86/pmap.c:1.202 Fri Jul 1 11:44:05 2016
+++ src/sys/arch/x86/x86/pmap.c Fri Jul 1 11:57:10 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.202 2016/07/01 11:44:05 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.203 2016/07/01 11:57:10 maxv Exp $ */
/*-
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.202 2016/07/01 11:44:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.203 2016/07/01 11:57:10 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -1509,6 +1509,14 @@ pmap_init_directmap(struct pmap *kpm)
lastpa = MAX(lastpa, mc->start + mc->size);
}
+ /*
+ * We allocate only one L4 entry for the direct map (PDIR_SLOT_DIRECT),
+ * so we cannot map more than 512GB.
+ */
+ if (lastpa > NBPD_L4) {
+ panic("RAM limit reached: > 512GB not supported");
+ }
+
/* Allocate L3. */
dm_pdp = pmap_bootstrap_palloc(1);