diff options
author | rsc <rsc> | 2009-05-31 00:28:45 +0000 |
---|---|---|
committer | rsc <rsc> | 2009-05-31 00:28:45 +0000 |
commit | 19333efb9eb634f17bea41d0cec8ee28c595cce8 (patch) | |
tree | 97350b8c0c4a4c0f61d76516f067b32298af37c7 /main.c | |
parent | 0c7f483838c48db05e7ea44232a55135d7c262a0 (diff) | |
download | xv6-labs-19333efb9eb634f17bea41d0cec8ee28c595cce8.tar.gz xv6-labs-19333efb9eb634f17bea41d0cec8ee28c595cce8.tar.bz2 xv6-labs-19333efb9eb634f17bea41d0cec8ee28c595cce8.zip |
Some proc cleanup, moving some of copyproc into allocproc.
Also, an experiment: use "thread-local" storage for c and cp
instead of the #define macro for curproc[cpu()].
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -5,6 +5,9 @@ #include "proc.h" #include "x86.h" +__thread struct cpu *c; +__thread struct proc *cp; + static void bootothers(void); static void mpmain(void) __attribute__((noreturn)); @@ -14,20 +17,22 @@ main(void) { mpinit(); // collect info about this machine lapicinit(mpbcpu()); + ksegment(); + picinit(); // interrupt controller + ioapicinit(); // another interrupt controller + consoleinit(); // I/O devices & their interrupts + uartinit(); // serial port cprintf("\ncpu%d: starting xv6\n\n", cpu()); - pinit(); // process table - binit(); // buffer cache - picinit(); // interrupt controller - ioapicinit(); // another interrupt controller kinit(); // physical memory allocator + pinit(); // process table tvinit(); // trap vectors + binit(); // buffer cache fileinit(); // file table iinit(); // inode cache - consoleinit(); // I/O devices & their interrupts - ideinit(); // disk + ideinit(); // disk if(!ismp) - timerinit(); // uniprocessor timer + timerinit(); // uniprocessor timer userinit(); // first user process bootothers(); // start other processors @@ -40,12 +45,12 @@ main(void) static void mpmain(void) { - cprintf("cpu%d: mpmain\n", cpu()); - idtinit(); if(cpu() != mpbcpu()) lapicinit(cpu()); - setupsegs(0); - xchg(&cpus[cpu()].booted, 1); + ksegment(); + cprintf("cpu%d: mpmain\n", cpu()); + idtinit(); + xchg(&c->booted, 1); cprintf("cpu%d: scheduling\n", cpu()); scheduler(); |