]>
Commit | Line | Data |
---|---|---|
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_DEBUG_BUGVERBOSE |
9 | ||
10 | #define __EMIT_BUG(x) do { \ | |
11 | asm volatile( \ | |
12 | "0: j 0b+2\n" \ | |
13 | "1:\n" \ | |
14 | ".section .rodata.str,\"aMS\",@progbits,1\n" \ | |
15 | "2: .asciz \""__FILE__"\"\n" \ | |
16 | ".previous\n" \ | |
325cdacd | 17 | ".section __bug_table,\"aw\"\n" \ |
52499f40 | 18 | "3: .long 1b-3b,2b-3b\n" \ |
c0007f1a HC |
19 | " .short %0,%1\n" \ |
20 | " .org 3b+%2\n" \ | |
21 | ".previous\n" \ | |
22 | : : "i" (__LINE__), \ | |
23 | "i" (x), \ | |
24 | "i" (sizeof(struct bug_entry))); \ | |
1da177e4 LT |
25 | } while (0) |
26 | ||
c0007f1a HC |
27 | #else /* CONFIG_DEBUG_BUGVERBOSE */ |
28 | ||
29 | #define __EMIT_BUG(x) do { \ | |
30 | asm volatile( \ | |
31 | "0: j 0b+2\n" \ | |
32 | "1:\n" \ | |
325cdacd | 33 | ".section __bug_table,\"aw\"\n" \ |
52499f40 | 34 | "2: .long 1b-2b\n" \ |
c0007f1a HC |
35 | " .short %0\n" \ |
36 | " .org 2b+%1\n" \ | |
37 | ".previous\n" \ | |
38 | : : "i" (x), \ | |
39 | "i" (sizeof(struct bug_entry))); \ | |
40 | } while (0) | |
41 | ||
42 | #endif /* CONFIG_DEBUG_BUGVERBOSE */ | |
43 | ||
2d6cd2a5 MS |
44 | #define BUG() do { \ |
45 | __EMIT_BUG(0); \ | |
5506e689 | 46 | unreachable(); \ |
2d6cd2a5 | 47 | } while (0) |
c0007f1a | 48 | |
19d43626 PZ |
49 | #define __WARN_FLAGS(flags) do { \ |
50 | __EMIT_BUG(BUGFLAG_WARNING|(flags)); \ | |
a9df8e32 HC |
51 | } while (0) |
52 | ||
c0007f1a | 53 | #define WARN_ON(x) ({ \ |
fd0cbdd3 | 54 | int __ret_warn_on = !!(x); \ |
c0007f1a HC |
55 | if (__builtin_constant_p(__ret_warn_on)) { \ |
56 | if (__ret_warn_on) \ | |
b2be0527 | 57 | __WARN(); \ |
c0007f1a HC |
58 | } else { \ |
59 | if (unlikely(__ret_warn_on)) \ | |
b2be0527 | 60 | __WARN(); \ |
c0007f1a HC |
61 | } \ |
62 | unlikely(__ret_warn_on); \ | |
63 | }) | |
64 | ||
1da177e4 | 65 | #define HAVE_ARCH_BUG |
c0007f1a HC |
66 | #define HAVE_ARCH_WARN_ON |
67 | #endif /* CONFIG_BUG */ | |
c8538a7a | 68 | |
1da177e4 LT |
69 | #include <asm-generic/bug.h> |
70 | ||
c0007f1a | 71 | #endif /* _ASM_S390_BUG_H */ |