This commit is contained in:
Frans Kaashoek 2015-11-15 13:40:42 -05:00
parent 5906118897
commit 50edfe1412

View file

@ -144,8 +144,8 @@ cgaputc(int c)
} else } else
crt[pos++] = (c&0xff) | 0x0700; // black on white crt[pos++] = (c&0xff) | 0x0700; // black on white
if(pos > 25*80) if(pos < 0 || pos > 25*80)
panic("pos overflow"); panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up. if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80); memmove(crt, crt+80, sizeof(crt[0])*23*80);
@ -189,13 +189,13 @@ struct {
void void
consoleintr(int (*getc)(void)) consoleintr(int (*getc)(void))
{ {
int c, dopd = 0; int c, doprocdump = 0;
acquire(&cons.lock); acquire(&cons.lock);
while((c = getc()) >= 0){ while((c = getc()) >= 0){
switch(c){ switch(c){
case C('P'): // Process listing. case C('P'): // Process listing.
dopd = 1; doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later
break; break;
case C('U'): // Kill line. case C('U'): // Kill line.
while(input.e != input.w && while(input.e != input.w &&
@ -224,10 +224,8 @@ consoleintr(int (*getc)(void))
} }
} }
release(&cons.lock); release(&cons.lock);
// Have to do this without the console lock held. if(doprocdump) {
if(dopd) { procdump(); // now call procdump() wo. cons.lock held
dopd = 0;
procdump();
} }
} }