add comment
[AROS.git] / rom / kernel / kernel_panic.c
blobc9f35a6bbfed905d51d46f25772176ae65cb02fd
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 */
8 #include <aros/config.h>
9 #include <asm/cpu.h>
11 #include <stdio.h>
13 #include "kernel_base.h"
14 #include "kernel_debug.h"
17 * This definition allows to move this buffer away from .bss.
18 * Can be used on native, by using, for example, zero page.
19 * This condition is considered fatal, there's no return.
21 #ifndef KERNEL_PANIC_BUFFER
22 static char panicBuffer[1024];
23 #define KERNEL_PANIC_BUFFER panicBuffer
24 #endif
26 void krnPanic(struct KernelBase *KernelBase,const char *fmt, ...)
28 const char *hdr = "Critical boot failure\n";
29 char *ptr = KERNEL_PANIC_BUFFER;
30 va_list ap;
32 /* Prepend the header */
33 while (*hdr)
34 *ptr++ = *hdr++;
36 /* vsprintf() here comes from librom.a */
37 va_start(ap, fmt);
38 vsprintf(ptr, fmt, ap);
39 va_end(ap);
41 krnDisplayAlert(KERNEL_PANIC_BUFFER, KernelBase);
43 #if AROS_FLAVOUR & AROS_FLAVOUR_STANDALONE
44 /* Hosted AROS may quit here */
45 for (;;) HALT;
46 #endif