From: Peter H. Froehlich Date: Sat, 3 Oct 2015 21:48:36 +0000 (-0400) Subject: Too many CPUs no longer crash. X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=7d3b1c2ccac2095ab585d9b47ddf4c93fce97fa7;p=xv6-public Too many CPUs no longer crash. --- diff --git a/mp.c b/mp.c index 224b1bd..a257749 100644 --- a/mp.c +++ b/mp.c @@ -106,6 +106,12 @@ mpinit(void) switch(*p){ case MPPROC: proc = (struct mpproc*)p; + if (ncpu >= NCPU) { + cprintf("mpinit: more than %d cpus, ignoring cpu%d\n", + NCPU, proc->apicid); + p += sizeof(struct mpproc); + continue; + } if(ncpu != proc->apicid){ cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid); ismp = 0;