Merge commit 'v2.6.28-rc8' into x86/doc
[sfrench/cifs-2.6.git] / arch / cris / include / arch-v10 / arch / bug.h
1 #ifndef __ASM_CRISv10_ARCH_BUG_H
2 #define __ASM_CRISv10_ARCH_BUG_H
3
4 #include <linux/stringify.h>
5
6 #ifdef CONFIG_BUG
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.
14  */
15
16 #define BUG_PREFIX 0x0D7F
17 #define BUG_MAGIC  0x00001234
18
19 struct bug_frame {
20         unsigned short prefix;
21         unsigned int magic;
22         unsigned short clear;
23         unsigned short movu;
24         unsigned short line;
25         unsigned short jump;
26         unsigned char *filename;
27 };
28
29 #if 0
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...
33  */
34 #define BUG()                                                           \
35         __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\
36                                 "movu.w %0,$r0\n\t"                     \
37                                 "jump %1\n\t"                           \
38                                 : : "i" (__LINE__), "i" (__FILE__))
39 #else
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.
44  */
45 #define BUG()                                                           \
46         __asm__ __volatile__ ("clear.d [" __stringify(BUG_MAGIC) "]\n\t"\
47                               "movu.w " __stringify(__LINE__) ",$r0\n\t"\
48                               "jump 0f\n\t"                             \
49                               ".section .rodata\n"                      \
50                               "0:\t.string \"" __FILE__ "\"\n\t"        \
51                               ".previous")
52 #endif
53
54 #else
55
56 /* This just causes an oops. */
57 #define BUG() (*(int *)0 = 0)
58
59 #endif
60
61 #define HAVE_ARCH_BUG
62 #endif
63
64 #include <asm-generic/bug.h>
65
66 #endif