From f6ed960fb20e2dc6607e6adf11461bf13fce5834 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 9 Dec 2004 19:44:05 +0000 Subject: [PATCH] Power off on kernel panic. Print different messages on kernel and user panics. --- src/lib/debug.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 -- 2.30.2