Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 Provide a module_map (16 MB for now...



details:   https://anonhg.NetBSD.org/src/rev/a6172e0a266c
branches:  trunk
changeset: 773561:a6172e0a266c
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Feb 06 10:40:26 2012 +0000

description:
Provide a module_map (16 MB for now) to load modules close to kernel text
and data.

Fixes PR port-sparc64/45895. Ok: releng

diffstat:

 sys/arch/sparc64/sparc64/machdep.c |  16 ++++++++++++++--
 sys/arch/sparc64/sparc64/pmap.c    |  20 ++++++++++++++++++--
 2 files changed, 32 insertions(+), 4 deletions(-)

diffs (101 lines):

diff -r 8702cee7b68e -r a6172e0a266c sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Mon Feb 06 04:29:47 2012 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Mon Feb 06 10:40:26 2012 +0000
@@ -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 @@
 #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 @@
 #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
 }
 
 /*
diff -r 8702cee7b68e -r a6172e0a266c sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c   Mon Feb 06 04:29:47 2012 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c   Mon Feb 06 10:40:26 2012 +0000
@@ -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 @@
 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 @@
 
        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.
         */



Home | Main Index | Thread Index | Old Index