diff options
author | Frans Kaashoek <[email protected]> | 2016-09-02 08:31:13 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2016-09-02 08:31:13 -0400 |
commit | ae15515d80559ff95b315e3342c3baa00b87be1c (patch) | |
tree | b61b17981cce96f0b66efc77a7ce479e3e66a843 /main.c | |
parent | 37939f24c2fbb12a57a628fedd024a4865741e74 (diff) | |
download | xv6-labs-ae15515d80559ff95b315e3342c3baa00b87be1c.tar.gz xv6-labs-ae15515d80559ff95b315e3342c3baa00b87be1c.tar.bz2 xv6-labs-ae15515d80559ff95b315e3342c3baa00b87be1c.zip |
APIC IDs may not be consecutive and start from zero, so we cannot really use it
as a direct index into cpus. Record apicid in struct cpu and have cpunum() look
for it. Replace cpu->id with cpunum() everywhere, and replace cpu->id with cpu->apicid.
Thanks to Xi Wang.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -22,7 +22,7 @@ main(void) mpinit(); // detect other processors lapicinit(); // interrupt controller seginit(); // segment descriptors - cprintf("\ncpu%d: starting xv6\n\n", cpu->id); + cprintf("\ncpu%d: starting xv6\n\n", cpunum()); picinit(); // another interrupt controller ioapicinit(); // another interrupt controller consoleinit(); // console hardware @@ -54,7 +54,7 @@ mpenter(void) static void mpmain(void) { - cprintf("cpu%d: starting\n", cpu->id); + cprintf("cpu%d: starting\n", cpunum()); idtinit(); // load idt register xchg(&cpu->started, 1); // tell startothers() we're up scheduler(); // start running processes @@ -89,7 +89,7 @@ startothers(void) *(void**)(code-8) = mpenter; *(int**)(code-12) = (void *) V2P(entrypgdir); - lapicstartap(c->id, V2P(code)); + lapicstartap(c->apicid, V2P(code)); // wait for cpu to finish mpmain() while(c->started == 0) |