Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys introduce vm_map_kernel, a subclass of vm_map, and
details: https://anonhg.NetBSD.org/src/rev/0913c34572b3
branches: trunk
changeset: 572388:0913c34572b3
user: yamt <yamt%NetBSD.org@localhost>
date: Sat Jan 01 21:02:12 2005 +0000
description:
introduce vm_map_kernel, a subclass of vm_map, and
move some kernel-only members of vm_map to it.
diffstat:
sys/arch/amiga/amiga/pmap.c | 6 ++--
sys/arch/atari/atari/pmap.c | 4 +-
sys/arch/m68k/m68k/pmap_motorola.c | 6 ++--
sys/kern/kern_malloc.c | 6 ++--
sys/uvm/uvm_extern.h | 4 +-
sys/uvm/uvm_km.c | 33 +++++++++++++++-------------
sys/uvm/uvm_map.c | 43 +++++++++++++++++++++++++++++--------
sys/uvm/uvm_map.h | 23 +++++++++++++++----
sys/uvm/uvm_map_i.h | 14 +++++++++--
9 files changed, 93 insertions(+), 46 deletions(-)
diffs (truncated from 430 to 300 lines):
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/arch/amiga/amiga/pmap.c
--- a/sys/arch/amiga/amiga/pmap.c Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/arch/amiga/amiga/pmap.c Sat Jan 01 21:02:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.110 2004/09/23 21:30:36 tron Exp $ */
+/* $NetBSD: pmap.c,v 1.111 2005/01/01 21:02:12 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2004/09/23 21:30:36 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2005/01/01 21:02:12 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -279,7 +279,7 @@
struct pmap kernel_pmap_store;
struct vm_map *pt_map;
-struct vm_map pt_map_store;
+struct vm_map_kernel pt_map_store;
vsize_t mem_size; /* memory size in bytes */
vaddr_t virtual_avail; /* VA of first avail page (after kernel bss)*/
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/arch/atari/atari/pmap.c
--- a/sys/arch/atari/atari/pmap.c Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/arch/atari/atari/pmap.c Sat Jan 01 21:02:12 2005 +0000
@@ -106,7 +106,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2003/09/27 20:01:58 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2005/01/01 21:02:13 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -277,7 +277,7 @@
struct pmap kernel_pmap_store;
struct vm_map *pt_map;
-struct vm_map pt_map_store;
+struct vm_map_kernel pt_map_store;
vsize_t mem_size; /* memory size in bytes */
paddr_t avail_end; /* PA of last available physical page */
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/arch/m68k/m68k/pmap_motorola.c
--- a/sys/arch/m68k/m68k/pmap_motorola.c Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/arch/m68k/m68k/pmap_motorola.c Sat Jan 01 21:02:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_motorola.c,v 1.11 2003/11/01 17:16:30 he Exp $ */
+/* $NetBSD: pmap_motorola.c,v 1.12 2005/01/01 21:02:13 yamt Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.11 2003/11/01 17:16:30 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.12 2005/01/01 21:02:13 yamt Exp $");
#include "opt_compat_hpux.h"
@@ -247,7 +247,7 @@
struct pmap kernel_pmap_store;
struct vm_map *st_map, *pt_map;
-struct vm_map st_map_store, pt_map_store;
+struct vm_map_kernel st_map_store, pt_map_store;
paddr_t avail_start; /* PA of first available physical page */
paddr_t avail_end; /* PA of last available physical page */
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/kern/kern_malloc.c Sat Jan 01 21:02:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_malloc.c,v 1.91 2005/01/01 03:24:43 simonb Exp $ */
+/* $NetBSD: kern_malloc.c,v 1.92 2005/01/01 21:02:13 yamt Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.91 2005/01/01 03:24:43 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.92 2005/01/01 21:02:13 yamt Exp $");
#include "opt_lockdebug.h"
@@ -78,7 +78,7 @@
#include <uvm/uvm_extern.h>
-static struct vm_map kmem_map_store;
+static struct vm_map_kernel kmem_map_store;
struct vm_map *kmem_map = NULL;
#include "opt_kmempages.h"
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/uvm/uvm_extern.h Sat Jan 01 21:02:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.94 2005/01/01 21:00:06 yamt Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.95 2005/01/01 21:02:13 yamt Exp $ */
/*
*
@@ -597,7 +597,7 @@
uvm_object *, vsize_t, int);
struct vm_map *uvm_km_suballoc(struct vm_map *, vaddr_t *,
vaddr_t *, vsize_t, int, boolean_t,
- struct vm_map *);
+ struct vm_map_kernel *);
vaddr_t uvm_km_valloc1(struct vm_map *, vsize_t,
vsize_t, voff_t, uvm_flag_t);
vaddr_t uvm_km_valloc(struct vm_map *, vsize_t);
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/uvm/uvm_km.c Sat Jan 01 21:02:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_km.c,v 1.70 2005/01/01 21:00:06 yamt Exp $ */
+/* $NetBSD: uvm_km.c,v 1.71 2005/01/01 21:02:13 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -134,11 +134,12 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.70 2005/01/01 21:00:06 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.71 2005/01/01 21:02:13 yamt Exp $");
#include "opt_uvmhist.h"
#include <sys/param.h>
+#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/proc.h>
@@ -154,7 +155,7 @@
* local data structues
*/
-static struct vm_map kernel_map_store;
+static struct vm_map_kernel kernel_map_store;
static struct vm_map_entry kernel_first_mapent_store;
/*
@@ -186,20 +187,21 @@
* have been allocated kernel space before installing.
*/
- uvm_map_setup(&kernel_map_store, base, end, VM_MAP_PAGEABLE);
- kernel_map_store.pmap = pmap_kernel();
+ uvm_map_setup_kernel(&kernel_map_store, base, end, VM_MAP_PAGEABLE);
+ kernel_map_store.vmk_map.pmap = pmap_kernel();
if (start != base) {
int error;
struct uvm_map_args args;
- error = uvm_map_prepare(&kernel_map_store, base, start - base,
+ error = uvm_map_prepare(&kernel_map_store.vmk_map,
+ base, start - base,
NULL, UVM_UNKNOWN_OFFSET, 0,
UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
UVM_ADV_RANDOM, UVM_FLAG_FIXED), &args);
if (!error) {
kernel_first_mapent_store.flags =
UVM_MAP_KERNEL | UVM_MAP_FIRST;
- error = uvm_map_enter(&kernel_map_store, &args,
+ error = uvm_map_enter(&kernel_map_store.vmk_map, &args,
&kernel_first_mapent_store);
}
@@ -212,7 +214,7 @@
* install!
*/
- kernel_map = &kernel_map_store;
+ kernel_map = &kernel_map_store.vmk_map;
}
/*
@@ -232,10 +234,12 @@
vsize_t size;
int flags;
boolean_t fixed;
- struct vm_map *submap;
+ struct vm_map_kernel *submap;
{
int mapflags = UVM_FLAG_NOMERGE | (fixed ? UVM_FLAG_FIXED : 0);
+ KASSERT(vm_map_pmap(map) == pmap_kernel());
+
size = round_page(size); /* round up to pagesize */
/*
@@ -260,22 +264,21 @@
pmap_reference(vm_map_pmap(map));
if (submap == NULL) {
- submap = uvm_map_create(vm_map_pmap(map), *min, *max, flags);
+ submap = malloc(sizeof(*submap), M_VMMAP, M_WAITOK);
if (submap == NULL)
panic("uvm_km_suballoc: unable to create submap");
- } else {
- uvm_map_setup(submap, *min, *max, flags);
- submap->pmap = vm_map_pmap(map);
}
+ uvm_map_setup_kernel(submap, *min, *max, flags);
+ submap->vmk_map.pmap = vm_map_pmap(map);
/*
* now let uvm_map_submap plug in it...
*/
- if (uvm_map_submap(map, *min, *max, submap) != 0)
+ if (uvm_map_submap(map, *min, *max, &submap->vmk_map) != 0)
panic("uvm_km_suballoc: submap allocation failed");
- return(submap);
+ return(&submap->vmk_map);
}
/*
diff -r a2bc7a2b8861 -r 0913c34572b3 sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Sat Jan 01 21:00:06 2005 +0000
+++ b/sys/uvm/uvm_map.c Sat Jan 01 21:02:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_map.c,v 1.174 2005/01/01 21:00:06 yamt Exp $ */
+/* $NetBSD: uvm_map.c,v 1.175 2005/01/01 21:02:13 yamt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.174 2005/01/01 21:00:06 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.175 2005/01/01 21:02:13 yamt Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -476,12 +476,13 @@
if (old_entry->flags & UVM_MAP_QUANTUM) {
int s;
+ struct vm_map_kernel *vmk = vm_map_to_kernel(map);
s = splvm();
simple_lock(&uvm.kentry_lock);
- me = map->merged_entries;
+ me = vmk->vmk_merged_entries;
KASSERT(me);
- map->merged_entries = me->next;
+ vmk->vmk_merged_entries = me->next;
simple_unlock(&uvm.kentry_lock);
splx(s);
KASSERT(me->flags & UVM_MAP_QUANTUM);
@@ -526,15 +527,17 @@
* keep this entry for later splitting.
*/
struct vm_map *map;
+ struct vm_map_kernel *vmk;
int s;
KASSERT(me->flags & UVM_MAP_KERNEL);
map = uvm_kmapent_map(me);
+ vmk = vm_map_to_kernel(map);
s = splvm();
simple_lock(&uvm.kentry_lock);
- me->next = map->merged_entries;
- map->merged_entries = me;
+ me->next = vmk->vmk_merged_entries;
+ vmk->vmk_merged_entries = me;
simple_unlock(&uvm.kentry_lock);
splx(s);
} else {
@@ -2582,6 +2585,23 @@
return error;
}
+/*
+ * uvm_map_setup_kernel: init in-kernel map
+ *
+ * => map must not be in service yet.
+ */
+
+void
+uvm_map_setup_kernel(struct vm_map_kernel *map,
+ vaddr_t min, vaddr_t max, int flags)
+{
+
+ uvm_map_setup(&map->vmk_map, min, max, flags);
+
Home |
Main Index |
Thread Index |
Old Index