diff options
author | julian <julian@FreeBSD.org> | 2002-02-07 20:58:47 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-02-07 20:58:47 +0000 |
commit | b5eb64d6f0fccb72419da5552deee22cb6117fac (patch) | |
tree | b267ad497d8d81c2c79c107443dabe850da2126b /sys/kern/init_main.c | |
parent | fce570367d0faf3002916a499e684172e61d8b9b (diff) | |
download | FreeBSD-src-b5eb64d6f0fccb72419da5552deee22cb6117fac.zip FreeBSD-src-b5eb64d6f0fccb72419da5552deee22cb6117fac.tar.gz |
Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.
Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r-- | sys/kern/init_main.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index a36fbcd..3ebc140 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -82,7 +82,7 @@ void mi_startup(void); /* Should be elsewhere */ static struct session session0; static struct pgrp pgrp0; struct proc proc0; -struct thread *thread0; +struct thread thread0; static struct procsig procsig0; static struct filedesc0 filedesc0; static struct plimit limit0; @@ -273,15 +273,12 @@ proc0_init(void *dummy __unused) register struct filedesc0 *fdp; register unsigned i; struct thread *td; + struct ksegrp *kg; + struct kse *ke; GIANT_REQUIRED; - /* - * This assumes the proc0 struct has already been linked - * using proc_linkup() in the machine specific initialisation - * e.g. i386_init() - */ p = &proc0; - td = thread0; + td = &thread0; /* * Initialize magic number. @@ -289,7 +286,7 @@ proc0_init(void *dummy __unused) p->p_magic = P_MAGIC; /* - * Initialize process and pgrp structures. + * Initialize thread, process and pgrp structures. */ procinit(); @@ -323,6 +320,8 @@ proc0_init(void *dummy __unused) p->p_sysent = &aout_sysvec; #endif + ke = &proc0.p_kse; /* XXXKSE */ + kg = &proc0.p_ksegrp; /* XXXKSE */ p->p_flag = P_SYSTEM; p->p_sflag = PS_INMEM; p->p_stat = SRUN; @@ -624,7 +623,7 @@ create_init(const void *udata __unused) { int error; - error = fork1(thread0, RFFDG | RFPROC | RFSTOPPED, &initproc); + error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, &initproc); if (error) panic("cannot fork init: %d\n", error); PROC_LOCK(initproc); @@ -633,7 +632,7 @@ create_init(const void *udata __unused) mtx_lock_spin(&sched_lock); initproc->p_sflag |= PS_INMEM; mtx_unlock_spin(&sched_lock); - cpu_set_fork_handler(&initproc->p_thread, start_init, NULL); + cpu_set_fork_handler(FIRST_THREAD_IN_PROC(initproc), start_init, NULL); } SYSINIT(init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init, NULL) @@ -643,10 +642,12 @@ SYSINIT(init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init, NULL) static void kick_init(const void *udata __unused) { + struct thread *td; + td = FIRST_THREAD_IN_PROC(initproc); mtx_lock_spin(&sched_lock); initproc->p_stat = SRUN; - setrunqueue(&initproc->p_thread); /* XXXKSE */ + setrunqueue(FIRST_THREAD_IN_PROC(initproc)); /* XXXKSE */ mtx_unlock_spin(&sched_lock); } SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kick_init, NULL) |