From 7fa0de680bbfed02e09ad517788fe336c0d855cc Mon Sep 17 00:00:00 2001
From: Richard Braun <rbraun@sceen.net>
Date: Sat, 17 Dec 2011 16:23:33 +0000
Subject: Adjust VM initialization

Unlike the zone allocator, the slab code can't be fed with an initial
chunk of memory. Some VM objects used early during startup now have to
be statically allocated, and kernel map entries need a special path
to avoid recursion when being allocated.

* vm/vm_map.c (vm_submap_object_store): New variable.
(vm_submap_object): Point to vm_submap_object_store.
(kentry_data_size): Initialize to arbitrary value.
(kentry_count): Remove variable.
(kentry_pagealloc): New function.
(vm_map_setup): Likewise.
(vm_map_create): Replace initialization with a call to vm_map_setup().
* vm/vm_map.h (vm_map_setup): New prototype.
* vm/vm_kern.c (kernel_map_store): New variable.
(kernel_map): Point to kernel_map_store.
(kmem_suballoc): Remove function. Replaced with...
(kmem_submap): New function.
(kmem_init): Call vm_map_setup() instead of vm_map_create().
* vm/vm_kern.h (kmem_suballoc): Remove prototype.
(kmem_submap): New prototype.
* vm/vm_object.c (kernel_object_store): New variable.
(kernel_object): Point to kernel_object_store.
(vm_object_template): Change type from vm_object_t to struct vm_object.
(_vm_object_setup): New function.
(_vm_object_allocate): Replace initialization with a call to
_vm_object_setup().
(vm_object_bootstrap): Don't allocate vm_object_template, and use it as
a structure instead of a pointer. Initialize kernel_object and
vm_submap_object with _vm_object_setup() instead of
_vm_object_allocate().
* vm/vm_resident.c (vm_page_bootstrap): Don't initialize
kentry_data_size.
* device/ds_routines.c (device_io_map_store): New variable.
(device_io_map): Point to device_io_map_store.
(mach_device_init): Call kmem_submap() instead of kmem_suballoc().
* ipc/ipc_init.c (ipc_kernel_map_store): New variable.
(ipc_kernel_map): Point to ipc_kernel_map_store.
---
 vm/vm_resident.c | 1 -
 1 file changed, 1 deletion(-)

(limited to 'vm/vm_resident.c')

diff --git a/vm/vm_resident.c b/vm/vm_resident.c
index 5a63ad4a..ae71a74d 100644
--- a/vm/vm_resident.c
+++ b/vm/vm_resident.c
@@ -238,7 +238,6 @@ void vm_page_bootstrap(
 	 *	Steal memory for the kernel map entries.
 	 */
 
-	kentry_data_size = kentry_count * sizeof(struct vm_map_entry);
 	kentry_data = pmap_steal_memory(kentry_data_size);
 
 	/*
-- 
cgit v1.2.3