init_main.c (2a024a2b050c695d6e91e22374806cc3efaa60b2) | init_main.c (74b2192ae6309fcbe617ed63389125ff0c152af2) |
---|---|
1/* 2 * Copyright (c) 1995 Terrence R. Lambert 3 * All rights reserved. 4 * 5 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 6 * The Regents of the University of California. All rights reserved. 7 * (c) UNIX System Laboratories, Inc. 8 * All or some portions of this file are derived from material licensed --- 25 unchanged lines hidden (view full) --- 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * @(#)init_main.c 8.9 (Berkeley) 1/21/94 | 1/* 2 * Copyright (c) 1995 Terrence R. Lambert 3 * All rights reserved. 4 * 5 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 6 * The Regents of the University of California. All rights reserved. 7 * (c) UNIX System Laboratories, Inc. 8 * All or some portions of this file are derived from material licensed --- 25 unchanged lines hidden (view full) --- 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * @(#)init_main.c 8.9 (Berkeley) 1/21/94 |
42 * $Id: init_main.c,v 1.76 1997/11/25 07:07:41 julian Exp $ | 42 * $Id: init_main.c,v 1.77 1997/12/06 04:11:09 sef Exp $ |
43 */ 44 45#include "opt_devfs.h" 46 47#include <sys/param.h> 48#include <sys/file.h> 49#include <sys/filedesc.h> 50#include <sys/kernel.h> 51#include <sys/mount.h> 52#include <sys/sysctl.h> 53#include <sys/proc.h> 54#include <sys/resourcevar.h> 55#include <sys/signalvar.h> 56#include <sys/systm.h> 57#include <sys/vnode.h> 58#include <sys/sysent.h> 59#include <sys/reboot.h> 60#include <sys/sysproto.h> 61#include <sys/vmmeter.h> | 43 */ 44 45#include "opt_devfs.h" 46 47#include <sys/param.h> 48#include <sys/file.h> 49#include <sys/filedesc.h> 50#include <sys/kernel.h> 51#include <sys/mount.h> 52#include <sys/sysctl.h> 53#include <sys/proc.h> 54#include <sys/resourcevar.h> 55#include <sys/signalvar.h> 56#include <sys/systm.h> 57#include <sys/vnode.h> 58#include <sys/sysent.h> 59#include <sys/reboot.h> 60#include <sys/sysproto.h> 61#include <sys/vmmeter.h> |
62#include <sys/unistd.h> |
|
62 63#include <machine/cpu.h> 64 65#include <vm/vm.h> 66#include <vm/vm_param.h> 67#include <vm/vm_prot.h> 68#include <sys/lock.h> 69#include <vm/pmap.h> --- 119 unchanged lines hidden (view full) --- 189 /* 190 * Traverse the (now) ordered list of system initialization tasks. 191 * Perform each task, and continue on to the next task. 192 * 193 * The last item on the list is expected to be the scheduler, 194 * which will not return. 195 */ 196 for( sipp = (struct sysinit **)sysinit_set.ls_items; *sipp; sipp++) { | 63 64#include <machine/cpu.h> 65 66#include <vm/vm.h> 67#include <vm/vm_param.h> 68#include <vm/vm_prot.h> 69#include <sys/lock.h> 70#include <vm/pmap.h> --- 119 unchanged lines hidden (view full) --- 190 /* 191 * Traverse the (now) ordered list of system initialization tasks. 192 * Perform each task, and continue on to the next task. 193 * 194 * The last item on the list is expected to be the scheduler, 195 * which will not return. 196 */ 197 for( sipp = (struct sysinit **)sysinit_set.ls_items; *sipp; sipp++) { |
198 |
|
197 if( (*sipp)->subsystem == SI_SUB_DUMMY) 198 continue; /* skip dummy task(s)*/ 199 200 switch( (*sipp)->type) { 201 case SI_TYPE_DEFAULT: 202 /* no special processing*/ 203 (*((*sipp)->func))( (*sipp)->udata); 204 break; 205 206 case SI_TYPE_KTHREAD: | 199 if( (*sipp)->subsystem == SI_SUB_DUMMY) 200 continue; /* skip dummy task(s)*/ 201 202 switch( (*sipp)->type) { 203 case SI_TYPE_DEFAULT: 204 /* no special processing*/ 205 (*((*sipp)->func))( (*sipp)->udata); 206 break; 207 208 case SI_TYPE_KTHREAD: |
209#if !defined(SMP) |
|
207 /* kernel thread*/ | 210 /* kernel thread*/ |
208 if (fork(&proc0, NULL)) | 211 if (fork1(&proc0, RFMEM|RFFDG|RFPROC)) 212 panic("fork kernel thread"); 213 cpu_set_fork_handler(pfind(proc0.p_retval[0]), 214 (*sipp)->func, (*sipp)->udata); 215 break; 216#endif 217 218 case SI_TYPE_KPROCESS: 219 if (fork1(&proc0, RFFDG|RFPROC)) |
209 panic("fork kernel process"); 210 cpu_set_fork_handler(pfind(proc0.p_retval[0]), 211 (*sipp)->func, (*sipp)->udata); 212 break; 213 214 default: 215 panic( "init_main: unrecognized init type"); 216 } --- 285 unchanged lines hidden (view full) --- 502 **** 1) This code returns to startup the system; this is 503 **** abnormal for a kernel thread. 504 **** 2) This code promiscuously uses init_frame 505 **** 506 *************************************************************************** 507 */ 508 509static void kthread_init __P((void *dummy)); | 220 panic("fork kernel process"); 221 cpu_set_fork_handler(pfind(proc0.p_retval[0]), 222 (*sipp)->func, (*sipp)->udata); 223 break; 224 225 default: 226 panic( "init_main: unrecognized init type"); 227 } --- 285 unchanged lines hidden (view full) --- 513 **** 1) This code returns to startup the system; this is 514 **** abnormal for a kernel thread. 515 **** 2) This code promiscuously uses init_frame 516 **** 517 *************************************************************************** 518 */ 519 520static void kthread_init __P((void *dummy)); |
510SYSINIT_KT(init,SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kthread_init, NULL) | 521SYSINIT_KP(init,SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kthread_init, NULL) |
511 512 513extern void prepare_usermode __P((void)); 514static void start_init __P((struct proc *p)); 515 516/* ARGSUSED*/ 517static void 518kthread_init(dummy) --- 118 unchanged lines hidden --- | 522 523 524extern void prepare_usermode __P((void)); 525static void start_init __P((struct proc *p)); 526 527/* ARGSUSED*/ 528static void 529kthread_init(dummy) --- 118 unchanged lines hidden --- |