1 #ifndef _ASM_POWERPC_BUG_H
2 #define _ASM_POWERPC_BUG_H
5 #include <asm/asm-compat.h>
7 * Define an illegal instr to trap on the bug.
8 * We don't use 0 because that marks the end of a function
9 * in the ELF ABI. That's "Boo Boo" in case you wonder...
11 #define BUG_OPCODE .long 0x00b00b00 /* For asm */
12 #define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
18 /* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
19 sizeof(struct bug_entry), respectively */
20 #ifdef CONFIG_DEBUG_BUGVERBOSE
21 #define _EMIT_BUG_ENTRY \
22 ".section __bug_table,\"a\"\n" \
23 "2:\t" PPC_LONG "1b, %0\n" \
28 #define _EMIT_BUG_ENTRY \
29 ".section __bug_table,\"a\"\n" \
30 "2:\t" PPC_LONG "1b\n" \
37 * BUG_ON() and WARN_ON() do their best to cooperate with compile-time
38 * optimisations. However depending on the complexity of the condition
39 * some compiler versions may not produce optimal results.
43 __asm__ __volatile__( \
46 : : "i" (__FILE__), "i" (__LINE__), \
47 "i" (0), "i" (sizeof(struct bug_entry))); \
51 #define BUG_ON(x) do { \
52 if (__builtin_constant_p(x)) { \
56 __asm__ __volatile__( \
57 "1: "PPC_TLNEI" %4,0\n" \
59 : : "i" (__FILE__), "i" (__LINE__), "i" (0), \
60 "i" (sizeof(struct bug_entry)), \
65 #define __WARN() do { \
66 __asm__ __volatile__( \
69 : : "i" (__FILE__), "i" (__LINE__), \
70 "i" (BUGFLAG_WARNING), \
71 "i" (sizeof(struct bug_entry))); \
74 #define WARN_ON(x) ({ \
75 typeof(x) __ret_warn_on = (x); \
76 if (__builtin_constant_p(__ret_warn_on)) { \
80 __asm__ __volatile__( \
81 "1: "PPC_TLNEI" %4,0\n" \
83 : : "i" (__FILE__), "i" (__LINE__), \
84 "i" (BUGFLAG_WARNING), \
85 "i" (sizeof(struct bug_entry)), \
86 "r" (__ret_warn_on)); \
88 unlikely(__ret_warn_on); \
92 #define HAVE_ARCH_BUG_ON
93 #define HAVE_ARCH_WARN_ON
94 #endif /* CONFIG_BUG */
95 #endif /* __ASSEMBLY __ */
97 #include <asm-generic/bug.h>
99 #endif /* __KERNEL__ */
100 #endif /* _ASM_POWERPC_BUG_H */