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