Module Name: src
Committed By: martin
Date: Mon Feb 6 10:40:26 UTC 2012
Modified Files:
src/sys/arch/sparc64/sparc64: machdep.c pmap.c
Log Message:
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.
Fixes PR port-sparc64/45895. Ok: releng
To generate a diff of this commit:
cvs rdiff -u -r1.264 -r1.265 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.275 -r1.276 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/machdep.c
diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.264 src/sys/arch/sparc64/sparc64/machdep.c:1.265
--- src/sys/arch/sparc64/sparc64/machdep.c:1.264 Fri Jan 27 18:53:03 2012
+++ src/sys/arch/sparc64/sparc64/machdep.c Mon Feb 6 10:40:26 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.264 2012/01/27 18:53:03 para Exp $ */
+/* $NetBSD: machdep.c,v 1.265 2012/02/06 10:40:26 martin Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -71,10 +71,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.264 2012/01/27 18:53:03 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.265 2012/02/06 10:40:26 martin Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
+#include "opt_modular.h"
#include "opt_compat_netbsd.h"
#include "opt_compat_svr4.h"
#include "opt_compat_sunos.h"
@@ -152,6 +153,11 @@ int sigpid = 0;
#endif
extern vaddr_t avail_end;
+#ifdef MODULAR
+vaddr_t module_start, module_end;
+static struct vm_map module_map_store;
+extern struct vm_map *module_map;
+#endif
int physmem;
@@ -208,6 +214,12 @@ cpu_startup(void)
#if 0
pmap_redzone();
#endif
+
+#ifdef MODULAR
+ uvm_map_setup(&module_map_store, module_start, module_end, 0);
+ module_map_store.pmap = pmap_kernel();
+ module_map = &module_map_store;
+#endif
}
/*
Index: src/sys/arch/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.275 src/sys/arch/sparc64/sparc64/pmap.c:1.276
--- src/sys/arch/sparc64/sparc64/pmap.c:1.275 Tue Jul 12 07:51:34 2011
+++ src/sys/arch/sparc64/sparc64/pmap.c Mon Feb 6 10:40:26 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.275 2011/07/12 07:51:34 mrg Exp $ */
+/* $NetBSD: pmap.c,v 1.276 2012/02/06 10:40:26 martin Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,13 +26,14 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.275 2011/07/12 07:51:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2012/02/06 10:40:26 martin Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
+#include "opt_modular.h"
#include <sys/param.h>
#include <sys/malloc.h>
@@ -669,6 +670,9 @@ pmap_read_memlist(const char *device, co
void
pmap_bootstrap(u_long kernelstart, u_long kernelend)
{
+#ifdef MODULAR
+ extern vaddr_t module_start, module_end;
+#endif
extern char etext[], data_start[]; /* start of data segment */
extern int msgbufmapped;
struct mem_region *mp, *mp1, *avail, *orig;
@@ -1176,6 +1180,18 @@ pmap_bootstrap(u_long kernelstart, u_lon
vmmap = (vaddr_t)reserve_dumppages((void *)(u_long)vmmap);
+#ifdef MODULAR
+ /*
+ * Reserve 16 MB of VA for module loading. Right now our full
+ * GENERIC kernel is about 13 MB, so this looks good enough.
+ * If we make this bigger, we should adjust the KERNEND and
+ * associated defines in param.h.
+ */
+ module_start = vmmap;
+ vmmap += 16 * 1024*1024;
+ module_end = vmmap;
+#endif
+
/*
* Set up bounds of allocatable memory for vmstat et al.
*/