diff options
author | Richard Braun <rbraun@sceen.net> | 2013-04-13 15:13:56 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-04-13 15:13:56 +0200 |
commit | c51eff25b8c4b8115859dd7b5a4c11207540756c (patch) | |
tree | 0cde5a5929551c27396300d9ae93b15418441d33 /kern/panic.c | |
parent | b9ad029638692203505438f67b3d80edb73f9d82 (diff) |
kern/panic: restrict handling to the first panic
Multiple panics occurring on different processors will usually produce
unhelpful traces. Also, the first is commonly the most important, often
being the same as the others, or more directly related to the root cause
of the problem.
Diffstat (limited to 'kern/panic.c')
-rw-r--r-- | kern/panic.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kern/panic.c b/kern/panic.c index f9c3f59e..bccf632b 100644 --- a/kern/panic.c +++ b/kern/panic.c @@ -19,13 +19,23 @@ #include <kern/panic.h> #include <kern/printk.h> +#include <machine/atomic.h> #include <machine/cpu.h> #include <machine/strace.h> +static unsigned long panic_done; + void panic(const char *format, ...) { va_list list; + unsigned long already_done; + + already_done = atomic_swap(&panic_done, 1); + + if (already_done) + for (;;) + cpu_idle(); cpu_intr_disable(); cpu_halt_broadcast(); |