Merge branches 'amd-iommu/fixes' and 'dma-debug/fixes' into iommu/fixes
[linux-2.6-block.git] / arch / s390 / include / asm / bug.h
CommitLineData
c0007f1a
HC
1#ifndef _ASM_S390_BUG_H
2#define _ASM_S390_BUG_H
1da177e4
LT
3
4#include <linux/kernel.h>
5
c8538a7a 6#ifdef CONFIG_BUG
4896cef8 7
c0007f1a
HC
8#ifdef CONFIG_64BIT
9#define S390_LONG ".quad"
f4a10b21 10#else
c0007f1a 11#define S390_LONG ".long"
f4a10b21 12#endif
f4a10b21 13
c0007f1a
HC
14#ifdef CONFIG_DEBUG_BUGVERBOSE
15
16#define __EMIT_BUG(x) do { \
17 asm volatile( \
18 "0: j 0b+2\n" \
19 "1:\n" \
20 ".section .rodata.str,\"aMS\",@progbits,1\n" \
21 "2: .asciz \""__FILE__"\"\n" \
22 ".previous\n" \
23 ".section __bug_table,\"a\"\n" \
24 "3:\t" S390_LONG "\t1b,2b\n" \
25 " .short %0,%1\n" \
26 " .org 3b+%2\n" \
27 ".previous\n" \
28 : : "i" (__LINE__), \
29 "i" (x), \
30 "i" (sizeof(struct bug_entry))); \
1da177e4
LT
31} while (0)
32
c0007f1a
HC
33#else /* CONFIG_DEBUG_BUGVERBOSE */
34
35#define __EMIT_BUG(x) do { \
36 asm volatile( \
37 "0: j 0b+2\n" \
38 "1:\n" \
39 ".section __bug_table,\"a\"\n" \
40 "2:\t" S390_LONG "\t1b\n" \
41 " .short %0\n" \
42 " .org 2b+%1\n" \
43 ".previous\n" \
44 : : "i" (x), \
45 "i" (sizeof(struct bug_entry))); \
46} while (0)
47
48#endif /* CONFIG_DEBUG_BUGVERBOSE */
49
2d6cd2a5
MS
50#define BUG() do { \
51 __EMIT_BUG(0); \
5506e689 52 unreachable(); \
2d6cd2a5 53} while (0)
c0007f1a 54
a9df8e32
HC
55#define __WARN() do { \
56 __EMIT_BUG(BUGFLAG_WARNING); \
57} while (0)
58
c0007f1a 59#define WARN_ON(x) ({ \
fd0cbdd3 60 int __ret_warn_on = !!(x); \
c0007f1a
HC
61 if (__builtin_constant_p(__ret_warn_on)) { \
62 if (__ret_warn_on) \
63 __EMIT_BUG(BUGFLAG_WARNING); \
64 } else { \
65 if (unlikely(__ret_warn_on)) \
66 __EMIT_BUG(BUGFLAG_WARNING); \
67 } \
68 unlikely(__ret_warn_on); \
69})
70
1da177e4 71#define HAVE_ARCH_BUG
c0007f1a
HC
72#define HAVE_ARCH_WARN_ON
73#endif /* CONFIG_BUG */
c8538a7a 74
1da177e4
LT
75#include <asm-generic/bug.h>
76
c0007f1a 77#endif /* _ASM_S390_BUG_H */