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 /mp.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 'mp.c')
-rw-r--r-- | mp.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -106,12 +106,10 @@ mpinit(void) switch(*p){ case MPPROC: proc = (struct mpproc*)p; - if(ncpu != proc->apicid){ - cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid); - ismp = 0; + if(ncpu < NCPU) { + cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu + ncpu++; } - cpus[ncpu].id = ncpu; - ncpu++; p += sizeof(struct mpproc); continue; case MPIOAPIC: @@ -125,8 +123,8 @@ mpinit(void) p += 8; continue; default: - cprintf("mpinit: unknown config type %x\n", *p); ismp = 0; + break; } } if(!ismp){ |