2 Copyright � 1995-2013, The AROS Development Team. All rights reserved.
9 * This file contains useful redefinition of bug() macro which uses
10 * kernel.resource's own debugging facilities. Include it if you
11 * need bug() in your code.
14 #ifndef __KERNEL_DEBUG_H_
15 #define __KERNEL_DEBUG_H_
17 #include <aros/config.h>
18 #include <aros/asmcall.h>
19 #include <aros/libcall.h>
22 #include "kernel_intern.h"
28 int krnPutC(int chr
, struct KernelBase
*KernelBase
);
29 int krnBug(const char *format
, va_list args
, APTR kernelBase
);
30 void krnDisplayAlert(const char *text
, struct KernelBase
*KernelBase
);
31 void krnPanic(struct KernelBase
*KernelBase
, const char *fmt
, ...);
34 #define __cli() __asm__ __volatile__("cli": : :"memory")
35 #define __sti() __asm__ __volatile__("sti": : :"memory")
37 #if defined(__AROSEXEC_SMP__)
38 #include <aros/atomic.h>
40 extern volatile ULONG safedebug
;
43 static inline void _bug(APTR kernelBase
, const char *format
, ...)
46 #if defined(__AROSEXEC_SMP__)
47 unsigned long flags
= 0;
54 va_start(args
, format
);
57 * We use internal entry here. This is done because this function can be used
58 * during early boot, while KernelBase is NULL. However it's still passed,
61 krnBug(format
, args
, kernelBase
);
64 #if defined(__AROSEXEC_SMP__)
67 __restore_flags(flags
);
72 #define bug(...) _bug(KernelBase, __VA_ARGS__)
73 #define nbug(...) _bug(NULL, __VA_ARGS__)