vm_init.c revision 12662
112163SRamaswamy.Tummala@Sun.COM/* 212163SRamaswamy.Tummala@Sun.COM * Copyright (c) 1991, 1993 312163SRamaswamy.Tummala@Sun.COM * The Regents of the University of California. All rights reserved. 412163SRamaswamy.Tummala@Sun.COM * 512163SRamaswamy.Tummala@Sun.COM * This code is derived from software contributed to Berkeley by 612163SRamaswamy.Tummala@Sun.COM * The Mach Operating System project at Carnegie-Mellon University. 712163SRamaswamy.Tummala@Sun.COM * 812163SRamaswamy.Tummala@Sun.COM * Redistribution and use in source and binary forms, with or without 912163SRamaswamy.Tummala@Sun.COM * modification, are permitted provided that the following conditions 1012163SRamaswamy.Tummala@Sun.COM * are met: 1112163SRamaswamy.Tummala@Sun.COM * 1. Redistributions of source code must retain the above copyright 1212163SRamaswamy.Tummala@Sun.COM * notice, this list of conditions and the following disclaimer. 1312163SRamaswamy.Tummala@Sun.COM * 2. Redistributions in binary form must reproduce the above copyright 1412163SRamaswamy.Tummala@Sun.COM * notice, this list of conditions and the following disclaimer in the 1512163SRamaswamy.Tummala@Sun.COM * documentation and/or other materials provided with the distribution. 1612163SRamaswamy.Tummala@Sun.COM * 3. All advertising materials mentioning features or use of this software 1712163SRamaswamy.Tummala@Sun.COM * must display the following acknowledgement: 1812163SRamaswamy.Tummala@Sun.COM * This product includes software developed by the University of 1912163SRamaswamy.Tummala@Sun.COM * California, Berkeley and its contributors. 2012163SRamaswamy.Tummala@Sun.COM * 4. Neither the name of the University nor the names of its contributors 2112163SRamaswamy.Tummala@Sun.COM * may be used to endorse or promote products derived from this software 2212163SRamaswamy.Tummala@Sun.COM * without specific prior written permission. 2312163SRamaswamy.Tummala@Sun.COM * 2412163SRamaswamy.Tummala@Sun.COM * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2512163SRamaswamy.Tummala@Sun.COM * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2612163SRamaswamy.Tummala@Sun.COM * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2712163SRamaswamy.Tummala@Sun.COM * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2812163SRamaswamy.Tummala@Sun.COM * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2912163SRamaswamy.Tummala@Sun.COM * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3012163SRamaswamy.Tummala@Sun.COM * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3112163SRamaswamy.Tummala@Sun.COM * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3212163SRamaswamy.Tummala@Sun.COM * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3312163SRamaswamy.Tummala@Sun.COM * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3412163SRamaswamy.Tummala@Sun.COM * SUCH DAMAGE. 3512163SRamaswamy.Tummala@Sun.COM * 3612163SRamaswamy.Tummala@Sun.COM * from: @(#)vm_init.c 8.1 (Berkeley) 6/11/93 3712163SRamaswamy.Tummala@Sun.COM * 3812163SRamaswamy.Tummala@Sun.COM * 3912163SRamaswamy.Tummala@Sun.COM * Copyright (c) 1987, 1990 Carnegie-Mellon University. 4012303SRajkumar.Sivaprakasam@Sun.COM * All rights reserved. 4112163SRamaswamy.Tummala@Sun.COM * 4212163SRamaswamy.Tummala@Sun.COM * Authors: Avadis Tevanian, Jr., Michael Wayne Young 4312163SRamaswamy.Tummala@Sun.COM * 4412163SRamaswamy.Tummala@Sun.COM * Permission to use, copy, modify and distribute this software and 4512163SRamaswamy.Tummala@Sun.COM * its documentation is hereby granted, provided that both the copyright 4612163SRamaswamy.Tummala@Sun.COM * notice and this permission notice appear in all copies of the 4712163SRamaswamy.Tummala@Sun.COM * software, derivative works or modified versions, and any portions 4812163SRamaswamy.Tummala@Sun.COM * thereof, and that both notices appear in supporting documentation. 4912163SRamaswamy.Tummala@Sun.COM * 5012163SRamaswamy.Tummala@Sun.COM * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 5112163SRamaswamy.Tummala@Sun.COM * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 5212163SRamaswamy.Tummala@Sun.COM * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 5312163SRamaswamy.Tummala@Sun.COM * 5412163SRamaswamy.Tummala@Sun.COM * Carnegie Mellon requests users of this software to return to 5512163SRamaswamy.Tummala@Sun.COM * 5612163SRamaswamy.Tummala@Sun.COM * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 5712163SRamaswamy.Tummala@Sun.COM * School of Computer Science 5812303SRajkumar.Sivaprakasam@Sun.COM * Carnegie Mellon University 5912303SRajkumar.Sivaprakasam@Sun.COM * Pittsburgh PA 15213-3890 6012303SRajkumar.Sivaprakasam@Sun.COM * 6112163SRamaswamy.Tummala@Sun.COM * any improvements or extensions that they make and grant Carnegie the 6212163SRamaswamy.Tummala@Sun.COM * rights to redistribute these changes. 6312163SRamaswamy.Tummala@Sun.COM * 6412163SRamaswamy.Tummala@Sun.COM * $Id: vm_init.c,v 1.10 1995/12/02 17:11:20 bde Exp $ 6512163SRamaswamy.Tummala@Sun.COM */ 6612163SRamaswamy.Tummala@Sun.COM 6712163SRamaswamy.Tummala@Sun.COM/* 6812163SRamaswamy.Tummala@Sun.COM * Initialize the Virtual Memory subsystem. 6912163SRamaswamy.Tummala@Sun.COM */ 7012163SRamaswamy.Tummala@Sun.COM 7112163SRamaswamy.Tummala@Sun.COM#include <sys/param.h> 7212163SRamaswamy.Tummala@Sun.COM#include <sys/kernel.h> 7312163SRamaswamy.Tummala@Sun.COM#include <sys/systm.h> 7412163SRamaswamy.Tummala@Sun.COM#include <sys/queue.h> 7512163SRamaswamy.Tummala@Sun.COM 7612163SRamaswamy.Tummala@Sun.COM#include <vm/vm.h> 77#include <vm/vm_param.h> 78#include <vm/vm_prot.h> 79#include <vm/lock.h> 80#include <vm/vm_object.h> 81#include <vm/vm_page.h> 82#include <vm/vm_map.h> 83#include <vm/vm_kern.h> 84#include <vm/vm_pager.h> 85#include <vm/vm_extern.h> 86 87/* 88 * System initialization 89 */ 90 91static void vm_mem_init __P((void *)); 92SYSINIT(vm_mem, SI_SUB_VM, SI_ORDER_FIRST, vm_mem_init, NULL) 93 94/* 95 * vm_init initializes the virtual memory system. 96 * This is done only by the first cpu up. 97 * 98 * The start and end address of physical memory is passed in. 99 */ 100 101/* ARGSUSED*/ 102static void 103vm_mem_init(dummy) 104 void *dummy; 105{ 106 /* 107 * Initializes resident memory structures. From here on, all physical 108 * memory is accounted for, and we use only virtual addresses. 109 */ 110 111 vm_set_page_size(); 112 virtual_avail = vm_page_startup(avail_start, avail_end, virtual_avail); 113 /* 114 * Initialize other VM packages 115 */ 116 vm_object_init(virtual_end - VM_MIN_KERNEL_ADDRESS); 117 vm_map_startup(); 118 kmem_init(virtual_avail, virtual_end); 119 pmap_init(avail_start, avail_end); 120 vm_pager_init(); 121} 122