4 #define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */
5 #define BUGFLAG_UNWINDER (1 << 1)
7 #ifdef CONFIG_GENERIC_BUG
9 #define HAVE_ARCH_WARN_ON
16 * %4 - sizeof(struct bug_entry)
18 * The trapa opcode itself sits in %0.
19 * The %O notation is used to avoid # generation.
21 * The offending file and line are encoded in the __bug_table section.
23 #ifdef CONFIG_DEBUG_BUGVERBOSE
24 #define _EMIT_BUG_ENTRY \
25 "\t.pushsection __bug_table,\"a\"\n" \
26 "2:\t.long 1b, %O1\n" \
27 "\t.short %O2, %O3\n" \
31 #define _EMIT_BUG_ENTRY \
32 "\t.pushsection __bug_table,\"a\"\n" \
41 __asm__ __volatile__ ( \
45 : "n" (TRAPA_BUG_OPCODE), \
47 "i" (__LINE__), "i" (0), \
48 "i" (sizeof(struct bug_entry))); \
53 __asm__ __volatile__ ( \
57 : "n" (TRAPA_BUG_OPCODE), \
60 "i" (BUGFLAG_WARNING), \
61 "i" (sizeof(struct bug_entry))); \
64 #define WARN_ON(x) ({ \
65 int __ret_warn_on = !!(x); \
66 if (__builtin_constant_p(__ret_warn_on)) { \
70 if (unlikely(__ret_warn_on)) \
73 unlikely(__ret_warn_on); \
76 #define UNWINDER_BUG() \
78 __asm__ __volatile__ ( \
82 : "n" (TRAPA_BUG_OPCODE), \
85 "i" (BUGFLAG_UNWINDER), \
86 "i" (sizeof(struct bug_entry))); \
89 #define UNWINDER_BUG_ON(x) ({ \
90 int __ret_unwinder_on = !!(x); \
91 if (__builtin_constant_p(__ret_unwinder_on)) { \
92 if (__ret_unwinder_on) \
95 if (unlikely(__ret_unwinder_on)) \
98 unlikely(__ret_unwinder_on); \
103 #define UNWINDER_BUG BUG
104 #define UNWINDER_BUG_ON BUG_ON
106 #endif /* CONFIG_GENERIC_BUG */
108 #include <asm-generic/bug.h>
110 #endif /* __ASM_SH_BUG_H */