1 #ifndef _ASM_POWERPC_BUG_H
2 #define _ASM_POWERPC_BUG_H
4 #include <asm/asm-compat.h>
6 * Define an illegal instr to trap on the bug.
7 * We don't use 0 because that marks the end of a function
8 * in the ELF ABI. That's "Boo Boo" in case you wonder...
10 #define BUG_OPCODE .long 0x00b00b00 /* For asm */
11 #define BUG_ILLEGAL_INSTR "0x00b00b00" /* For BUG macro */
16 unsigned long bug_addr
;
22 struct bug_entry
*find_bug(unsigned long bugaddr
);
25 * If this bit is set in the line number it means that the trap
26 * is for WARN_ON rather than BUG or BUG_ON.
28 #define BUG_WARNING_TRAP 0x1000000
33 __asm__ __volatile__( \
35 ".section __bug_table,\"a\"\n" \
36 "\t"PPC_LONG" 1b,%0,%1,%2\n" \
38 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
41 #define BUG_ON(x) do { \
42 __asm__ __volatile__( \
43 "1: "PPC_TLNEI" %0,0\n" \
44 ".section __bug_table,\"a\"\n" \
45 "\t"PPC_LONG" 1b,%1,%2,%3\n" \
47 : : "r" ((long)(x)), "i" (__LINE__), \
48 "i" (__FILE__), "i" (__FUNCTION__)); \
51 #define WARN_ON(x) do { \
52 __asm__ __volatile__( \
53 "1: "PPC_TLNEI" %0,0\n" \
54 ".section __bug_table,\"a\"\n" \
55 "\t"PPC_LONG" 1b,%1,%2,%3\n" \
57 : : "r" ((long)(x)), \
58 "i" (__LINE__ + BUG_WARNING_TRAP), \
59 "i" (__FILE__), "i" (__FUNCTION__)); \
63 #define HAVE_ARCH_BUG_ON
64 #define HAVE_ARCH_WARN_ON
65 #endif /* CONFIG_BUG */
66 #endif /* __ASSEMBLY __ */
68 #include <asm-generic/bug.h>
70 #endif /* _ASM_POWERPC_BUG_H */