diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2004-06-13 21:49:30 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 2004-06-13 21:49:30 +0000 |
commit | 2dd254afa61a7c0cc5ae920b463d3d4266852804 (patch) | |
tree | 7adbebef3be24ba910fd83ee1ba09e1577ae21a8 /sys/kern/init_main.c | |
parent | 4d62e331dcde739b4067d712dd602c0927ce11b3 (diff) |
debranch SMP, have fun
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 55dad5457b4..a8d052d0a05 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.115 2004/06/09 20:18:28 art Exp $ */ +/* $OpenBSD: init_main.c,v 1.116 2004/06/13 21:49:26 niklas Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -125,7 +125,6 @@ struct timeval boottime; #ifndef __HAVE_CPUINFO struct timeval runtime; #endif - int ncpus = 1; #if !defined(NO_PROPOLICE) @@ -188,6 +187,7 @@ main(framep) int s, i; register_t rval[2]; extern struct pdevinit pdevinit[]; + extern struct SIMPLELOCK kprintf_slock; extern void scheduler_start(void); extern void disk_init(void); extern void endtsleep(void *); @@ -213,8 +213,13 @@ main(framep) */ config_init(); /* init autoconfiguration data structures */ consinit(); + + SIMPLE_LOCK_INIT(&kprintf_slock); + printf("%s\n", copyright); + KERNEL_LOCK_INIT(); + uvm_init(); disk_init(); /* must come before autoconfiguration */ tty_init(); /* initialise tty's */ @@ -270,7 +275,7 @@ main(framep) session0.s_leader = p; p->p_flag = P_INMEM | P_SYSTEM | P_NOCLDWAIT; - p->p_stat = SRUN; + p->p_stat = SONPROC; p->p_nice = NZERO; p->p_emul = &emul_native; bcopy("swapper", p->p_comm, sizeof ("swapper")); @@ -344,6 +349,9 @@ main(framep) /* Start real time and statistics clocks. */ initclocks(); + /* Lock the kernel on behalf of proc0. */ + KERNEL_PROC_LOCK(p); + #ifdef SYSVSHM /* Initialize System V style shared memory. */ shminit(); @@ -413,8 +421,6 @@ main(framep) VOP_UNLOCK(rootvnode, 0, p); p->p_fd->fd_rdir = NULL; - uvm_swap_init(); - /* * Now can look at time, having had a chance to verify the time * from the file system. Reset p->p_rtime as it may have been @@ -424,10 +430,12 @@ main(framep) p->p_stats->p_start = mono_time = boottime = time; p->p_cpu->ci_schedstate.spc_runtime = time; #else - p->p_stats->p_start = runtime = mono_time = boottime = time; + p->p_stats->p_start = runtime = mono_time = boottime = time; #endif p->p_rtime.tv_sec = p->p_rtime.tv_usec = 0; + uvm_swap_init(); + /* Create process 1 (init(8)). */ if (fork1(p, SIGCHLD, FORK_FORK, NULL, 0, start_init, NULL, rval)) panic("fork init"); @@ -465,6 +473,12 @@ main(framep) srandom((u_long)(rtv.tv_sec ^ rtv.tv_usec)); randompid = 1; + +#if defined(MULTIPROCESSOR) + /* Boot the secondary processors. */ + cpu_boot_secondary_processors(); +#endif + /* The scheduler is an infinite loop. */ uvm_scheduler(); /* NOTREACHED */ @@ -623,8 +637,10 @@ start_init(arg) * Now try to exec the program. If can't for any reason * other than it doesn't exist, complain. */ - if ((error = sys_execve(p, &args, retval)) == 0) + if ((error = sys_execve(p, &args, retval)) == 0) { + KERNEL_PROC_UNLOCK(p); return; + } if (error != ENOENT) printf("exec %s: error %d\n", path, error); } |