suppress write() output after panic()

This commit is contained in:
Robert Morris 2020-08-28 05:44:09 -04:00 committed by Frans Kaashoek
parent de434fd933
commit 748809e1b3
2 changed files with 7 additions and 1 deletions

View file

@ -66,6 +66,12 @@ int
consolewrite(int user_src, uint64 src, int n) consolewrite(int user_src, uint64 src, int n)
{ {
int i; int i;
extern volatile int panicked; // from printf.c
if(panicked){
for(;;)
;
}
acquire(&cons.lock); acquire(&cons.lock);
for(i = 0; i < n; i++){ for(i = 0; i < n; i++){

View file

@ -121,7 +121,7 @@ panic(char *s)
printf("panic: "); printf("panic: ");
printf(s); printf(s);
printf("\n"); printf("\n");
panicked = 1; // freeze other CPUs panicked = 1; // freeze output from other CPUs
for(;;) for(;;)
; ;
} }