]> Devi Nivas Git - cs3210-lab0.git/commitdiff
use panic
authorFrans Kaashoek <kaashoek@mit.edu>
Thu, 2 Feb 2017 00:21:43 +0000 (19:21 -0500)
committerFrans Kaashoek <kaashoek@mit.edu>
Thu, 2 Feb 2017 00:21:43 +0000 (19:21 -0500)
console.c
proc.c

index f7e1e7394226ad4457943c28469abbed591dda85..da28f9f5a627f690197429e12eec73d78244cf7f 100644 (file)
--- a/console.c
+++ b/console.c
@@ -111,7 +111,8 @@ panic(char *s)
 
   cli();
   cons.locking = 0;
-  cprintf("cpu %d: panic: ", cpuid());
+  // use lapiccpunum so that we can call panic from mycpu()
+  cprintf("cpu %d: panic: ", lapiccpunum());
   cprintf(s);
   cprintf("\n");
   getcallerpcs(&s, pcs);
diff --git a/proc.c b/proc.c
index 9f500f2695408942d5c10bc437f29d711b82a34a..ca343cb36d8c6097295668eefcd7aab0b9dd0294 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -36,12 +36,8 @@ cpuid() {
 struct cpu*
 mycpu(void)
 {
-  if(readeflags()&FL_IF){
-    // Would prefer to panic but panic calls mycpu().
-    cprintf("mycpu called from %x with interrupts enabled\n",
-        __builtin_return_address(0));
-  }
-
+  if(readeflags()&FL_IF)
+    panic("mycpu called with interrupts enabled\n");
   return &cpus[lapiccpunum()];
 }