debugging rearrangements

This commit is contained in:
rsc 2006-09-07 16:52:13 +00:00
parent ab17e3198b
commit 5a71f93301

View file

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