diff options
author | Russ Cox <[email protected]> | 2009-08-30 23:02:08 -0700 |
---|---|---|
committer | Russ Cox <[email protected]> | 2009-08-30 23:02:08 -0700 |
commit | 48755214c9a02d6249caf3126d3b41d67eda4730 (patch) | |
tree | 2edc8b996fd7c3ef2da8876d657140e242999d93 /main.c | |
parent | 0aef8914959af9e472852611eb6352c211093d35 (diff) | |
download | xv6-labs-48755214c9a02d6249caf3126d3b41d67eda4730.tar.gz xv6-labs-48755214c9a02d6249caf3126d3b41d67eda4730.tar.bz2 xv6-labs-48755214c9a02d6249caf3126d3b41d67eda4730.zip |
assorted fixes:
* rename c/cp to cpu/proc
* rename cpu.context to cpu.scheduler
* fix some comments
* formatting for printout
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -5,8 +5,8 @@ #include "proc.h" #include "x86.h" -__thread struct cpu *c; -__thread struct proc *cp; +__thread struct cpu *cpu; +__thread struct proc *proc; static void bootothers(void); static void mpmain(void) __attribute__((noreturn)); @@ -22,7 +22,7 @@ main(void) ioapicinit(); // another interrupt controller consoleinit(); // I/O devices & their interrupts uartinit(); // serial port - cprintf("\ncpu%d: starting xv6\n\n", cpu()); + cprintf("\ncpu%d: starting xv6\n\n", cpu->id); kinit(); // physical memory allocator pinit(); // process table @@ -45,14 +45,14 @@ main(void) static void mpmain(void) { - if(cpu() != mpbcpu()) - lapicinit(cpu()); + if(cpunum() != mpbcpu()) + lapicinit(cpunum()); ksegment(); - cprintf("cpu%d: mpmain\n", cpu()); + cprintf("cpu%d: mpmain\n", cpu->id); idtinit(); - xchg(&c->booted, 1); + xchg(&cpu->booted, 1); - cprintf("cpu%d: scheduling\n", cpu()); + cprintf("cpu%d: scheduling\n", cpu->id); scheduler(); } @@ -69,14 +69,14 @@ bootothers(void) memmove(code, _binary_bootother_start, (uint)_binary_bootother_size); for(c = cpus; c < cpus+ncpu; c++){ - if(c == cpus+cpu()) // We've started already. + if(c == cpus+cpunum()) // We've started already. continue; // Fill in %esp, %eip and start code on cpu. stack = kalloc(KSTACKSIZE); *(void**)(code-4) = stack + KSTACKSIZE; *(void**)(code-8) = mpmain; - lapicstartap(c->apicid, (uint)code); + lapicstartap(c->id, (uint)code); // Wait for cpu to get through bootstrap. while(c->booted == 0) |