|
49 | 49 | ".previous\n" |
50 | 50 | #endif |
51 | 51 |
|
| 52 | +#define BUG_ENTRY(insn, flags, ...) \ |
| 53 | + __asm__ __volatile__( \ |
| 54 | + "1: " insn "\n" \ |
| 55 | + _EMIT_BUG_ENTRY \ |
| 56 | + : : "i" (__FILE__), "i" (__LINE__), \ |
| 57 | + "i" (flags), \ |
| 58 | + "i" (sizeof(struct bug_entry)), \ |
| 59 | + ##__VA_ARGS__) |
| 60 | + |
52 | 61 | /* |
53 | 62 | * BUG_ON() and WARN_ON() do their best to cooperate with compile-time |
54 | 63 | * optimisations. However depending on the complexity of the condition |
55 | 64 | * some compiler versions may not produce optimal results. |
56 | 65 | */ |
57 | 66 |
|
58 | 67 | #define BUG() do { \ |
59 | | - __asm__ __volatile__( \ |
60 | | - "1: twi 31,0,0\n" \ |
61 | | - _EMIT_BUG_ENTRY \ |
62 | | - : : "i" (__FILE__), "i" (__LINE__), \ |
63 | | - "i" (0), "i" (sizeof(struct bug_entry))); \ |
| 68 | + BUG_ENTRY("twi 31, 0, 0", 0); \ |
64 | 69 | unreachable(); \ |
65 | 70 | } while (0) |
66 | 71 |
|
|
69 | 74 | if (x) \ |
70 | 75 | BUG(); \ |
71 | 76 | } else { \ |
72 | | - __asm__ __volatile__( \ |
73 | | - "1: "PPC_TLNEI" %4,0\n" \ |
74 | | - _EMIT_BUG_ENTRY \ |
75 | | - : : "i" (__FILE__), "i" (__LINE__), "i" (0), \ |
76 | | - "i" (sizeof(struct bug_entry)), \ |
77 | | - "r" ((__force long)(x))); \ |
| 77 | + BUG_ENTRY(PPC_TLNEI " %4, 0", 0, "r" ((__force long)(x))); \ |
78 | 78 | } \ |
79 | 79 | } while (0) |
80 | 80 |
|
81 | | -#define __WARN_FLAGS(flags) do { \ |
82 | | - __asm__ __volatile__( \ |
83 | | - "1: twi 31,0,0\n" \ |
84 | | - _EMIT_BUG_ENTRY \ |
85 | | - : : "i" (__FILE__), "i" (__LINE__), \ |
86 | | - "i" (BUGFLAG_WARNING|(flags)), \ |
87 | | - "i" (sizeof(struct bug_entry))); \ |
88 | | -} while (0) |
| 81 | +#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags)) |
89 | 82 |
|
90 | 83 | #define WARN_ON(x) ({ \ |
91 | 84 | int __ret_warn_on = !!(x); \ |
92 | 85 | if (__builtin_constant_p(__ret_warn_on)) { \ |
93 | 86 | if (__ret_warn_on) \ |
94 | 87 | __WARN(); \ |
95 | 88 | } else { \ |
96 | | - __asm__ __volatile__( \ |
97 | | - "1: "PPC_TLNEI" %4,0\n" \ |
98 | | - _EMIT_BUG_ENTRY \ |
99 | | - : : "i" (__FILE__), "i" (__LINE__), \ |
100 | | - "i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\ |
101 | | - "i" (sizeof(struct bug_entry)), \ |
102 | | - "r" (__ret_warn_on)); \ |
| 89 | + BUG_ENTRY(PPC_TLNEI " %4, 0", \ |
| 90 | + BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ |
| 91 | + "r" (__ret_warn_on)); \ |
103 | 92 | } \ |
104 | 93 | unlikely(__ret_warn_on); \ |
105 | 94 | }) |
|
0 commit comments