From 5a71f9330162dd9f8a302c3ed1fa33539acdfdec Mon Sep 17 00:00:00 2001
From: rsc <rsc>
Date: Thu, 7 Sep 2006 16:52:13 +0000
Subject: debugging rearrangements

---
 console.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

(limited to 'console.c')

diff --git a/console.c b/console.c
index 52ccc10..449c03f 100644
--- a/console.c
+++ b/console.c
@@ -5,6 +5,7 @@
 #include "spinlock.h"
 #include "dev.h"
 #include "param.h"
+#include "mmu.h"
 
 struct spinlock console_lock;
 int panicked = 0;
@@ -151,11 +152,17 @@ cprintf(char *fmt, ...)
 void
 panic(char *s)
 {
+  int i;
+  uint pcs[10];
+  
   __asm __volatile("cli");
   use_console_lock = 0;
   cprintf("panic (%d): ", cpu());
   cprintf(s, 0);
   cprintf("\n", 0);
+  getcallerpcs(&s, pcs);
+  for(i=0; i<10; i++)
+    cprintf(" %p", pcs[i]);
   panicked = 1; // freeze other CPU
   for(;;)
     ;
@@ -323,22 +330,18 @@ kbd_intr()
   acquire(&kbd_lock);
 
   st = inb(KBSTATP);
-  if((st & KBS_DIB) == 0){
-    release(&kbd_lock);
-    return;
-  }
+  if((st & KBS_DIB) == 0)
+    goto out;
   data = inb(KBDATAP);
 
   if(data == 0xE0) {
     shift |= E0ESC;
-    release(&kbd_lock);
-    return;
+    goto out;
   } else if(data & 0x80) {
     // Key released
     data = (shift & E0ESC ? data : data & 0x7F);
     shift &= ~(shiftcode[data] | E0ESC);
-    release(&kbd_lock);
-    return;
+    goto out;
   } else if(shift & E0ESC) {
     // Last character was an E0 escape; or with 0x80
     data |= 0x80;
@@ -375,12 +378,11 @@ kbd_intr()
       if(kbd_w >= KBD_BUF)
         kbd_w = 0;
       wakeup(&kbd_r);
-    } else {
-      cprintf("kbd overflow\n");
     }
     break;
   }
 
+out:
   release(&kbd_lock);
 }
 
-- 
cgit v1.2.3