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