Linux 2.6.31.6
[linux/fpc-iii.git] / arch / blackfin / include / asm / bug.h
blob655e49540e41d902b6396d5a2dbbb4ae594b2778
1 #ifndef _BLACKFIN_BUG_H
2 #define _BLACKFIN_BUG_H
4 #ifdef CONFIG_BUG
6 #define BFIN_BUG_OPCODE 0xefcd
8 #ifdef CONFIG_DEBUG_BUGVERBOSE
10 #define _BUG_OR_WARN(flags) \
11 asm volatile( \
12 "1: .hword %0\n" \
13 " .section __bug_table,\"a\",@progbits\n" \
14 "2: .long 1b\n" \
15 " .long %1\n" \
16 " .short %2\n" \
17 " .short %3\n" \
18 " .org 2b + %4\n" \
19 " .previous" \
20 : \
21 : "i"(BFIN_BUG_OPCODE), "i"(__FILE__), \
22 "i"(__LINE__), "i"(flags), \
23 "i"(sizeof(struct bug_entry)))
25 #else
27 #define _BUG_OR_WARN(flags) \
28 asm volatile( \
29 "1: .hword %0\n" \
30 " .section __bug_table,\"a\",@progbits\n" \
31 "2: .long 1b\n" \
32 " .short %1\n" \
33 " .org 2b + %2\n" \
34 " .previous" \
35 : \
36 : "i"(BFIN_BUG_OPCODE), "i"(flags), \
37 "i"(sizeof(struct bug_entry)))
39 #endif /* CONFIG_DEBUG_BUGVERBOSE */
41 #define BUG() \
42 do { \
43 _BUG_OR_WARN(0); \
44 for (;;); \
45 } while (0)
47 #define WARN_ON(condition) \
48 ({ \
49 int __ret_warn_on = !!(condition); \
50 if (unlikely(__ret_warn_on)) \
51 _BUG_OR_WARN(BUGFLAG_WARNING); \
52 unlikely(__ret_warn_on); \
55 #define HAVE_ARCH_BUG
56 #define HAVE_ARCH_WARN_ON
58 #endif
60 #include <asm-generic/bug.h>
62 #endif