Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/amd64 Explain why we should use kernel_map in...
details: https://anonhg.NetBSD.org/src/rev/060ea9bef1fc
branches: trunk
changeset: 346227:060ea9bef1fc
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Jul 02 07:22:09 2016 +0000
description:
Explain why we should use kernel_map instead of module_map, and why we
can't.
We should probably add some GCC flags in the modules makefiles to make
sure the relocations generated are not 32bit.
Related to PR/43438.
diffstat:
sys/arch/amd64/amd64/machdep.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diffs (43 lines):
diff -r 3456f1fb8daf -r 060ea9bef1fc sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Fri Jul 01 23:29:17 2016 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Sat Jul 02 07:22:09 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.219 2016/07/01 12:41:28 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.220 2016/07/02 07:22:09 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.219 2016/07/01 12:41:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.220 2016/07/02 07:22:09 maxv Exp $");
/* #define XENDEBUG_LOW */
@@ -371,11 +371,22 @@
minaddr = 0;
/*
- * Allocate a submap for physio
+ * Allocate a submap for physio.
*/
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, 0, false, NULL);
+ VM_PHYS_SIZE, 0, false, NULL);
+ /*
+ * Create the module map.
+ *
+ * XXX: the module map is taken as what is left of the bootstrap memory
+ * created in locore.S, which is not big enough if we want to load many
+ * modules dynamically. We really should be using kernel_map instead.
+ *
+ * But because of the R_X86_64_32 relocations that are usually present
+ * in dynamic modules, the module map must be in low memory, and this
+ * wouldn't been guaranteed if we were using kernel_map.
+ */
uvm_map_setup(&module_map_store, module_start, module_end, 0);
module_map_store.pmap = pmap_kernel();
module_map = &module_map_store;
Home |
Main Index |
Thread Index |
Old Index