- zsize = mem_size >> 2; /* Get target zone size as 1/4 of physical memory */
- if(zsize < ZONE_MAP_MIN) zsize = ZONE_MAP_MIN; /* Clamp to min */
- if(zsize > ZONE_MAP_MAX) zsize = ZONE_MAP_MAX; /* Clamp to max */
- zone_init(zsize); /* Allocate address space for zones */
-
+ kmem_alloc_ready = TRUE;
+
+ if (PE_parse_boot_argn("zsize", &zsizearg, sizeof (zsizearg)))
+ zsize = zsizearg * 1024ULL * 1024ULL;
+ else {
+ zsize = sane_size >> 2; /* Get target zone size as 1/4 of physical memory */
+ }
+
+ if (zsize < ZONE_MAP_MIN)
+ zsize = ZONE_MAP_MIN; /* Clamp to min */
+#if defined(__LP64__)
+ zsize += zsize >> 1;
+#endif /* __LP64__ */
+ if (zsize > sane_size >> 1)
+ zsize = sane_size >> 1; /* Clamp to half of RAM max */
+#if !__LP64__
+ if (zsize > ZONE_MAP_MAX)
+ zsize = ZONE_MAP_MAX; /* Clamp to 1.5GB max for K32 */
+#endif /* !__LP64__ */
+
+ vm_mem_bootstrap_kprintf(("vm_mem_bootstrap: calling kext_alloc_init\n"));
+ kext_alloc_init();
+
+ vm_mem_bootstrap_kprintf(("vm_mem_bootstrap: calling zone_init\n"));
+ assert((vm_size_t) zsize == zsize);
+ zone_init((vm_size_t) zsize); /* Allocate address space for zones */
+
+ /* The vm_page_zone must be created prior to kalloc_init; that
+ * routine can trigger zalloc()s (for e.g. mutex statistic structure
+ * initialization). The vm_page_zone must exist to saisfy fictitious
+ * page allocations (which are used for guard pages by the guard
+ * mode zone allocator).
+ */
+ vm_mem_bootstrap_kprintf(("vm_mem_bootstrap: calling vm_page_module_init\n"));
+ vm_page_module_init();
+
+ vm_mem_bootstrap_kprintf(("vm_mem_bootstrap: calling kalloc_init\n"));