projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Power off on kernel panic.
[pintos-anon]
/
src
/
lib
/
debug.c
diff --git
a/src/lib/debug.c
b/src/lib/debug.c
index 2388a2daa3f23c7773c21094122b13c17c413610..7d520638c8cd9a9e8e60a3874b5ce5ae1dee7845 100644
(file)
--- 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, ...)
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
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");
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 ();
#ifdef KERNEL
serial_flush ();
-
for (;;
);
+
power_off (
);
#else
exit (1);
#endif
#else
exit (1);
#endif