diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-26 04:44:44 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-26 04:44:44 +0000 |
commit | 548a1931905604077210d8a8c72f502eccc42246 (patch) | |
tree | e24b2e772aeeb18cb2a3cfa0843be1ef6b0b22eb /sys/kern/init_main.c | |
parent | 192c7d21f30350696e505d70e6fbe8f6d282e28a (diff) |
initialize uvm, make allocations work with uvm, namchanges for uvm, etc
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 9aa037efd9d..50eb1176215 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.35 1999/01/11 01:37:13 niklas Exp $ */ +/* $OpenBSD: init_main.c,v 1.36 1999/02/26 04:44:43 art Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -89,6 +89,10 @@ #include <vm/vm.h> #include <vm/vm_pageout.h> +#if defined(UVM) +#include <uvm/uvm.h> +#endif + #include <net/if.h> #include <net/raw_cb.h> @@ -198,11 +202,15 @@ main(framep) printf(copyright); printf(copyright_openbsd); +#if defined(UVM) + uvm_init(); +#else vm_mem_init(); kmeminit(); #if defined(MACHINE_NEW_NONCONTIG) vm_page_physrehash(); #endif +#endif /* UVM */ disk_init(); /* must come before autoconfiguration */ tty_init(); /* initialise tty's */ cpu_startup(); @@ -254,19 +262,30 @@ main(framep) limit0.pl_rlimit[RLIMIT_NOFILE].rlim_max = MIN(NOFILE_MAX, (maxfiles - NOFILE > NOFILE) ? maxfiles - NOFILE : NOFILE); limit0.pl_rlimit[RLIMIT_NPROC].rlim_cur = MAXUPRC; +#if defined(UVM) + i = ptoa(uvmexp.free); +#else i = ptoa(cnt.v_free_count); +#endif /* UVM */ limit0.pl_rlimit[RLIMIT_RSS].rlim_max = i; limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_max = i; limit0.pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = i / 3; limit0.p_refcnt = 1; /* Allocate a prototype map so we have something to fork. */ +#if defined(UVM) + uvmspace_init(&vmspace0, pmap_kernel(), round_page(VM_MIN_ADDRESS), + trunc_page(VM_MAX_ADDRESS), TRUE); + p->p_vmspace = &vmspace0; +#else p->p_vmspace = &vmspace0; vmspace0.vm_refcnt = 1; pmap_pinit(&vmspace0.vm_pmap); vm_map_init(&p->p_vmspace->vm_map, round_page(VM_MIN_ADDRESS), trunc_page(VM_MAX_ADDRESS), TRUE); vmspace0.vm_map.pmap = &vmspace0.vm_pmap; +#endif /* UVM */ + p->p_addr = proc0paddr; /* XXX */ /* @@ -284,7 +303,11 @@ main(framep) rqinit(); /* Configure virtual memory system, set vm rlimits. */ +#if defined(UVM) + uvm_init_limits(p); +#else vm_init_limits(p); +#endif /* Initialize the file systems. */ #if defined(NFSSERVER) || defined(NFSCLIENT) @@ -364,7 +387,11 @@ main(framep) VREF(filedesc0.fd_fd.fd_cdir); VOP_UNLOCK(rootvnode, 0, p); filedesc0.fd_fd.fd_rdir = NULL; +#if defined(UVM) + uvm_swap_init(); +#else swapinit(); +#endif /* * Now can look at time, having had a chance to verify the time @@ -412,7 +439,11 @@ main(framep) randompid = 1; /* The scheduler is an infinite loop. */ +#if defined(UVM) + uvm_scheduler(); +#else scheduler(); +#endif /* NOTREACHED */ } @@ -486,9 +517,19 @@ start_init(arg) * Need just enough stack to hold the faked-up "execve()" arguments. */ addr = USRSTACK - PAGE_SIZE; +#if defined(UVM) + if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, + NULL, UVM_UNKNOWN_OFFSET, + UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, + UVM_ADV_NORMAL, + UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)) + != KERN_SUCCESS) + panic("init: couldn't allocate argument space"); +#else if (vm_allocate(&p->p_vmspace->vm_map, &addr, (vm_size_t)PAGE_SIZE, FALSE) != 0) panic("init: couldn't allocate argument space"); +#endif p->p_vmspace->vm_maxsaddr = (caddr_t)addr; for (pathp = &initpaths[0]; (path = *pathp) != NULL; pathp++) { @@ -568,7 +609,11 @@ void start_pagedaemon(arg) void *arg; { +#if defined(UVM) + uvm_pageout(); +#else vm_pageout(); +#endif /* NOTREACHED */ } |