revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / include / asm-parisc / bug.h
blob8121f7af76fc7589edaeeaec377d172f5668061e
1 #ifndef _PARISC_BUG_H
2 #define _PARISC_BUG_H
4 /*
5 * Tell the user there is some problem.
6 * The offending file and line are encoded in the __bug_table section.
7 */
9 #ifdef CONFIG_BUG
11 /* the break instruction is used as BUG() marker. */
12 #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
13 #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
15 #if defined(CONFIG_64BIT)
16 #define ASM_WORD_INSN ".dword\t"
17 #else
18 #define ASM_WORD_INSN ".word\t"
19 #endif
21 #ifdef CONFIG_DEBUG_BUGVERBOSE
22 #define BUG() \
23 do { \
24 asm volatile("\n" \
25 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
26 "\t.pushsection __bug_table,\"a\"\n" \
27 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
28 "\t.short %c1, %c2\n" \
29 "\t.org 2b+%c3\n" \
30 "\t.popsection" \
31 : : "i" (__FILE__), "i" (__LINE__), \
32 "i" (0), "i" (sizeof(struct bug_entry)) ); \
33 for(;;) ; \
34 } while(0)
36 #else
37 #define BUG() \
38 do { \
39 asm volatile(PARISC_BUG_BREAK_ASM : : ); \
40 for(;;) ; \
41 } while(0)
42 #endif
44 #ifdef CONFIG_DEBUG_BUGVERBOSE
45 #define __WARN() \
46 do { \
47 asm volatile("\n" \
48 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
49 "\t.pushsection __bug_table,\"a\"\n" \
50 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
51 "\t.short %c1, %c2\n" \
52 "\t.org 2b+%c3\n" \
53 "\t.popsection" \
54 : : "i" (__FILE__), "i" (__LINE__), \
55 "i" (BUGFLAG_WARNING), \
56 "i" (sizeof(struct bug_entry)) ); \
57 } while(0)
58 #else
59 #define __WARN() \
60 do { \
61 asm volatile("\n" \
62 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
63 "\t.pushsection __bug_table,\"a\"\n" \
64 "2:\t" ASM_WORD_INSN "1b\n" \
65 "\t.short %c0\n" \
66 "\t.org 2b+%c1\n" \
67 "\t.popsection" \
68 : : "i" (BUGFLAG_WARNING), \
69 "i" (sizeof(struct bug_entry)) ); \
70 } while(0)
71 #endif
74 #define WARN_ON(x) ({ \
75 int __ret_warn_on = !!(x); \
76 if (__builtin_constant_p(__ret_warn_on)) { \
77 if (__ret_warn_on) \
78 __WARN(); \
79 } else { \
80 if (unlikely(__ret_warn_on)) \
81 __WARN(); \
82 } \
83 unlikely(__ret_warn_on); \
86 #endif
88 #include <asm-generic/bug.h>
89 #endif