mp: do not panic on surprising hw

This commit is contained in:
Russ Cox 2011-01-11 13:16:28 -05:00
parent 1a81e38b17
commit af6a6a4775

15
mp.c
View file

@ -113,9 +113,10 @@ mpinit(void)
switch(*p){ switch(*p){
case MPPROC: case MPPROC:
proc = (struct mpproc*)p; proc = (struct mpproc*)p;
cprintf("mpproc %d\n", proc->apicid);
if(ncpu != proc->apicid){ if(ncpu != proc->apicid){
cprintf("mpinit: ncpu=%d apicpid=%d\n", ncpu, proc->apicid); cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
panic("mpinit"); ismp = 0;
} }
if(proc->flags & MPBOOT) if(proc->flags & MPBOOT)
bcpu = &cpus[ncpu]; bcpu = &cpus[ncpu];
@ -135,9 +136,17 @@ mpinit(void)
continue; continue;
default: default:
cprintf("mpinit: unknown config type %x\n", *p); cprintf("mpinit: unknown config type %x\n", *p);
panic("mpinit"); ismp = 0;
} }
} }
if(!ismp){
// Didn't like what we found; fall back to no MP.
ncpu = 1;
lapic = 0;
ioapicid = 0;
return;
}
if(mp->imcrp){ if(mp->imcrp){
// Bochs doesn't support IMCR, so this doesn't run on Bochs. // Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware. // But it would on real hardware.