]> hydra-www.ietfng.org Git - xv6-public/commitdiff
Too many CPUs no longer crash.
authorPeter H. Froehlich <peter.hans.froehlich@gmail.com>
Sat, 3 Oct 2015 21:48:36 +0000 (17:48 -0400)
committerPeter H. Froehlich <peter.hans.froehlich@gmail.com>
Sat, 3 Oct 2015 21:48:36 +0000 (17:48 -0400)
mp.c

diff --git a/mp.c b/mp.c
index 224b1bdc3630720c7c44f4a5ee3a437887a9141b..a257749588bd490ec0c03095ee2278bdb9c1fb8c 100644 (file)
--- 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;