1 #ifndef __ASM_CRISv10_ARCH_BUG_H
2 #define __ASM_CRISv10_ARCH_BUG_H
4 #include <linux/stringify.h>
7 #ifdef CONFIG_DEBUG_BUGVERBOSE
8 /* The BUG() macro is used for marking obviously incorrect code paths.
9 * It will cause a message with the file name and line number to be printed,
10 * and then cause an oops. The message is actually printed by handle_BUG()
11 * in arch/cris/kernel/traps.c, and the reason we use this method of storing
12 * the file name and line number is that we do not want to affect the registers
13 * by calling printk() before causing the oops.
16 #define BUG_PREFIX 0x0D7F
17 #define BUG_MAGIC 0x00001234
20 unsigned short prefix;
26 unsigned char *filename;
30 /* Unfortunately this version of the macro does not work due to a problem
31 * with the compiler (aka a bug) when compiling with -O2, which sometimes
32 * erroneously causes the second input to be stored in a register...
35 __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\
38 : : "i" (__LINE__), "i" (__FILE__))
40 /* This version will have to do for now, until the compiler is fixed.
41 * The drawbacks of this version are that the file name will appear multiple
42 * times in the .rodata section, and that __LINE__ and __FILE__ can probably
43 * not be used like this with newer versions of gcc.
46 __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\
47 "movu.w " __stringify(__LINE__) ",$r0\n\t"\
49 ".section .rodata\n" \
50 "0:\t.string \"" __FILE__ "\"\n\t" \
56 /* This just causes an oops. */
57 #define BUG() (*(int *)0 = 0)
64 #include <asm-generic/bug.h>