1 #ifndef _ASM_POWERPC_BUG_H
2 #define _ASM_POWERPC_BUG_H
5 * Define an illegal instr to trap on the bug.
6 * We don't use 0 because that marks the end of a function
7 * in the ELF ABI. That's "Boo Boo" in case you wonder...
9 #define BUG_OPCODE .long 0x00b00b00 /* For asm */
10 #define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
15 #define BUG_TABLE_ENTRY ".llong"
16 #define BUG_TRAP_OP "tdnei"
18 #define BUG_TABLE_ENTRY ".long"
19 #define BUG_TRAP_OP "twnei"
20 #endif /* __powerpc64__ */
23 unsigned long bug_addr;
29 struct bug_entry *find_bug(unsigned long bugaddr);
32 * If this bit is set in the line number it means that the trap
33 * is for WARN_ON rather than BUG or BUG_ON.
35 #define BUG_WARNING_TRAP 0x1000000
40 __asm__ __volatile__( \
42 ".section __bug_table,\"a\"\n" \
43 "\t"BUG_TABLE_ENTRY" 1b,%0,%1,%2\n" \
45 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
48 #define BUG_ON(x) do { \
49 __asm__ __volatile__( \
50 "1: "BUG_TRAP_OP" %0,0\n" \
51 ".section __bug_table,\"a\"\n" \
52 "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \
54 : : "r" ((long)(x)), "i" (__LINE__), \
55 "i" (__FILE__), "i" (__FUNCTION__)); \
58 #define WARN_ON(x) do { \
59 __asm__ __volatile__( \
60 "1: "BUG_TRAP_OP" %0,0\n" \
61 ".section __bug_table,\"a\"\n" \
62 "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \
64 : : "r" ((long)(x)), \
65 "i" (__LINE__ + BUG_WARNING_TRAP), \
66 "i" (__FILE__), "i" (__FUNCTION__)); \
70 #define HAVE_ARCH_BUG_ON
71 #define HAVE_ARCH_WARN_ON
72 #endif /* CONFIG_BUG */
73 #endif /* __ASSEMBLY __ */
75 #include <asm-generic/bug.h>
77 #endif /* _ASM_POWERPC_BUG_H */