From: Ben Pfaff Date: Thu, 9 Dec 2004 19:44:05 +0000 (+0000) Subject: Power off on kernel panic. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9f0f2802c11a0ae6fa39fa846c37df25731ad3d;p=pintos-anon Power off on kernel panic. Print different messages on kernel and user panics. --- diff --git a/src/lib/debug.c b/src/lib/debug.c index 2388a2d..7d52063 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -61,8 +61,9 @@ debug_message (const char *file, int line, const char *function, } } -/* Halts the OS, printing the source file name, line number, and - function name, plus a user-specific message. */ +/* Halts the OS or user program, printing the source file name, + line number, and function name, plus a user-specific + message. */ void debug_panic (const char *file, int line, const char *function, const char *message, ...) @@ -73,7 +74,12 @@ debug_panic (const char *file, int line, const char *function, intr_disable (); #endif - printf ("PANIC at %s:%d in %s(): ", file, line, function); +#ifdef KERNEL + printf ("Kernel PANIC at %s:%d in %s(): ", file, line, function); +#else + printf ("User process panic at %s:%d in %s(): ", file, line, function); +#endif + va_start (args, message); vprintf (message, args); printf ("\n"); @@ -83,7 +89,7 @@ debug_panic (const char *file, int line, const char *function, #ifdef KERNEL serial_flush (); - for (;;); + power_off (); #else exit (1); #endif