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(label, line, file, func) \
16 ".llong " #label ", " #line ", " #file ", " #func "\n"
17 #define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n"
19 #define BUG_TABLE_ENTRY(label, line, file, func) \
20 ".long " #label ", " #line ", " #file ", " #func "\n"
21 #define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n"
22 #endif /* __powerpc64__ */
25 unsigned long bug_addr;
31 struct bug_entry *find_bug(unsigned long bugaddr);
34 * If this bit is set in the line number it means that the trap
35 * is for WARN_ON rather than BUG or BUG_ON.
37 #define BUG_WARNING_TRAP 0x1000000
42 __asm__ __volatile__( \
44 ".section __bug_table,\"a\"\n\t" \
45 BUG_TABLE_ENTRY(1b,%0,%1,%2) \
47 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
50 #define BUG_ON(x) do { \
51 __asm__ __volatile__( \
53 ".section __bug_table,\"a\"\n\t" \
54 BUG_TABLE_ENTRY(1b,%1,%2,%3) \
56 : : "r" ((long)(x)), "i" (__LINE__), \
57 "i" (__FILE__), "i" (__FUNCTION__)); \
60 #define WARN_ON(x) do { \
61 __asm__ __volatile__( \
63 ".section __bug_table,\"a\"\n\t" \
64 BUG_TABLE_ENTRY(1b,%1,%2,%3) \
66 : : "r" ((long)(x)), \
67 "i" (__LINE__ + BUG_WARNING_TRAP), \
68 "i" (__FILE__), "i" (__FUNCTION__)); \
72 #define HAVE_ARCH_BUG_ON
73 #define HAVE_ARCH_WARN_ON
74 #endif /* CONFIG_BUG */
75 #endif /* __ASSEMBLY __ */
77 #include <asm-generic/bug.h>
79 #endif /* _ASM_POWERPC_BUG_H */