summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2015-11-15 13:40:42 -0500
committerFrans Kaashoek <[email protected]>2015-11-15 13:40:42 -0500
commit50edfe1412e5389ce4e3078b223e7b2e72e6ba66 (patch)
tree15f721c981913e4386113af176bf5d1daedfd90f
parent5906118897ef71e21a4868eb33f631eaa22b3800 (diff)
downloadxv6-labs-50edfe1412e5389ce4e3078b223e7b2e72e6ba66.tar.gz
xv6-labs-50edfe1412e5389ce4e3078b223e7b2e72e6ba66.tar.bz2
xv6-labs-50edfe1412e5389ce4e3078b223e7b2e72e6ba66.zip
nits
-rw-r--r--console.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/console.c b/console.c
index a699dd0..35f221d 100644
--- a/console.c
+++ b/console.c
@@ -144,8 +144,8 @@ cgaputc(int c)
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
- if(pos > 25*80)
- panic("pos overflow");
+ if(pos < 0 || pos > 25*80)
+ panic("pos under/overflow");
if((pos/80) >= 24){ // Scroll up.
memmove(crt, crt+80, sizeof(crt[0])*23*80);
@@ -189,13 +189,13 @@ struct {
void
consoleintr(int (*getc)(void))
{
- int c, dopd = 0;
+ int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
switch(c){
case C('P'): // Process listing.
- dopd = 1;
+ doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later
break;
case C('U'): // Kill line.
while(input.e != input.w &&
@@ -224,10 +224,8 @@ consoleintr(int (*getc)(void))
}
}
release(&cons.lock);
- // Have to do this without the console lock held.
- if(dopd) {
- dopd = 0;
- procdump();
+ if(doprocdump) {
+ procdump(); // now call procdump() wo. cons.lock held
}
}