blob: 655e49540e41d902b6396d5a2dbbb4ae594b2778 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001#ifndef _BLACKFIN_BUG_H
2#define _BLACKFIN_BUG_H
Mike Frysinger2d191232008-04-24 08:58:44 +08003
4#ifdef CONFIG_BUG
Mike Frysinger2d191232008-04-24 08:58:44 +08005
Mike Frysinger70f12562009-06-07 17:18:25 -04006#define BFIN_BUG_OPCODE 0xefcd
7
8#ifdef CONFIG_DEBUG_BUGVERBOSE
9
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)))
24
25#else
26
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)))
38
39#endif /* CONFIG_DEBUG_BUGVERBOSE */
40
41#define BUG() \
42 do { \
43 _BUG_OR_WARN(0); \
44 for (;;); \
45 } while (0)
46
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); \
53 })
54
55#define HAVE_ARCH_BUG
56#define HAVE_ARCH_WARN_ON
Mike Frysinger2d191232008-04-24 08:58:44 +080057
58#endif
59
Bryan Wu1394f032007-05-06 14:50:22 -070060#include <asm-generic/bug.h>
Mike Frysinger2d191232008-04-24 08:58:44 +080061
Bryan Wu1394f032007-05-06 14:50:22 -070062#endif