Fixes kern/3835: SMP kernel crash on enable "dumps on wd0"

- SMP: set value of curproc in main(), before the SYSINIT stuff runs.

Reviewed by:	Bruce Evans <bde@zeta.org.au>
This commit is contained in:
Steve Passe 1997-08-07 21:22:29 +00:00
parent ab1733642c
commit 6b556c4b4c

View File

@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $Id: init_main.c,v 1.66 1997/07/10 11:44:42 davidn Exp $
* $Id: init_main.c,v 1.67 1997/08/05 00:01:21 dyson Exp $
*/
#include "opt_rlimit.h"
@ -62,9 +62,6 @@
#include <sys/vmmeter.h>
#include <machine/cpu.h>
#if defined(SMP)
#include <machine/smp.h>
#endif /* SMP */
#include <vm/vm.h>
#include <vm/vm_param.h>
@ -162,6 +159,17 @@ main(framep)
*/
init_framep = framep;
#ifdef SMP
/*
* XXX curproc is per-cpu in SMP, and exists in freshly mapped pages,
* so its value must be initialized now before it is used by various
* initialization routines. proc0_init() isn't soon enough:
* among other things, configure() is called first, and may call
* setdumpdev(), which panics without a valid curproc.
*/
curproc = &proc0;
#endif /* SMP */
/*
* Perform a bubble sort of the system initialization objects by
* their subsystem (primary key) and order (secondary key).