Skip to content
Snippets Groups Projects
Commit 5a71f933 authored by rsc's avatar rsc
Browse files

debugging rearrangements

parent ab17e319
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ ...@@ -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, ...) ...@@ -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() ...@@ -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() ...@@ -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);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment