Page MenuHomeFreeBSD

D47934.diff
No OneTemporary

D47934.diff

diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c
--- a/sys/vm/vm_kern.c
+++ b/sys/vm/vm_kern.c
@@ -830,8 +830,7 @@
vm_size_t quantum;
int domain;
- vm_map_init(kernel_map, kernel_pmap, VM_MIN_KERNEL_ADDRESS, end);
- kernel_map->system_map = 1;
+ vm_map_init_system(kernel_map, kernel_pmap, VM_MIN_KERNEL_ADDRESS, end);
vm_map_lock(kernel_map);
/* N.B.: cannot use kgdb to debug, starting with this assignment ... */
(void)vm_map_insert(kernel_map, NULL, 0,
diff --git a/sys/vm/vm_map.h b/sys/vm/vm_map.h
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -203,8 +203,10 @@
*/
struct vm_map {
struct vm_map_entry header; /* List of entries */
- struct sx lock; /* Lock for map data */
- struct mtx system_mtx;
+ union {
+ struct sx lock; /* Lock for map data */
+ struct mtx system_mtx;
+ };
int nentries; /* Number of entries */
vm_size_t size; /* virtual size */
u_int timestamp; /* Version number */
@@ -484,6 +486,7 @@
vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t);
int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);
void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t);
+void vm_map_init_system(vm_map_t, pmap_t, vm_offset_t, vm_offset_t);
int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int);
int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *,
vm_pindex_t *, vm_prot_t *, boolean_t *);
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -292,9 +292,7 @@
vm = (struct vmspace *)mem;
map = &vm->vm_map;
- memset(map, 0, sizeof(*map));
- mtx_init(&map->system_mtx, "vm map (system)", NULL,
- MTX_DEF | MTX_DUPOK);
+ memset(map, 0, sizeof(*map)); /* set map->system_map = false */
sx_init(&map->lock, "vm map (user)");
PMAP_LOCK_INIT(vmspace_pmap(vm));
return (0);
@@ -890,7 +888,6 @@
map->header.eflags = MAP_ENTRY_HEADER;
map->needs_wakeup = FALSE;
- map->system_map = 0;
map->pmap = pmap;
map->header.end = min;
map->header.start = max;
@@ -908,13 +905,20 @@
void
vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max)
{
-
_vm_map_init(map, pmap, min, max);
- mtx_init(&map->system_mtx, "vm map (system)", NULL,
- MTX_DEF | MTX_DUPOK);
+ map->system_map = false;
sx_init(&map->lock, "vm map (user)");
}
+void
+vm_map_init_system(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max)
+{
+ _vm_map_init(map, pmap, min, max);
+ map->system_map = true;
+ mtx_init(&map->system_mtx, "vm map (system)", NULL, MTX_DEF |
+ MTX_DUPOK);
+}
+
/*
* vm_map_entry_dispose: [ internal use only ]
*

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 27, 9:39 PM (8 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16213985
Default Alt Text
D47934.diff (2 KB)

Event Timeline