mm-only debug patch...
[mmotm.git] / arch / blackfin / include / asm / bug.h
blob6f4548a1355539191e077770f090b548c3eb17ee
1 /*
2 * Copyright 2004-2009 Analog Devices Inc.
4 * Licensed under the GPL-2 or later.
5 */
7 #ifndef _BLACKFIN_BUG_H
8 #define _BLACKFIN_BUG_H
10 #ifdef CONFIG_BUG
12 #define BFIN_BUG_OPCODE 0xefcd
14 #ifdef CONFIG_DEBUG_BUGVERBOSE
16 #define _BUG_OR_WARN(flags) \
17 asm volatile( \
18 "1: .hword %0\n" \
19 " .section __bug_table,\"a\",@progbits\n" \
20 "2: .long 1b\n" \
21 " .long %1\n" \
22 " .short %2\n" \
23 " .short %3\n" \
24 " .org 2b + %4\n" \
25 " .previous" \
26 : \
27 : "i"(BFIN_BUG_OPCODE), "i"(__FILE__), \
28 "i"(__LINE__), "i"(flags), \
29 "i"(sizeof(struct bug_entry)))
31 #else
33 #define _BUG_OR_WARN(flags) \
34 asm volatile( \
35 "1: .hword %0\n" \
36 " .section __bug_table,\"a\",@progbits\n" \
37 "2: .long 1b\n" \
38 " .short %1\n" \
39 " .org 2b + %2\n" \
40 " .previous" \
41 : \
42 : "i"(BFIN_BUG_OPCODE), "i"(flags), \
43 "i"(sizeof(struct bug_entry)))
45 #endif /* CONFIG_DEBUG_BUGVERBOSE */
47 #define BUG() \
48 do { \
49 _BUG_OR_WARN(0); \
50 for (;;); \
51 } while (0)
53 #define WARN_ON(condition) \
54 ({ \
55 int __ret_warn_on = !!(condition); \
56 if (unlikely(__ret_warn_on)) \
57 _BUG_OR_WARN(BUGFLAG_WARNING); \
58 unlikely(__ret_warn_on); \
61 #define HAVE_ARCH_BUG
62 #define HAVE_ARCH_WARN_ON
64 #endif
66 #include <asm-generic/bug.h>
68 #endif