|
2 | 2 | #ifndef __ASM_BUG_H
|
3 | 3 | #define __ASM_BUG_H
|
4 | 4 |
|
5 |
| -#include <linux/compiler.h> |
| 5 | +#include <asm/break.h> |
| 6 | +#include <linux/stringify.h> |
| 7 | + |
| 8 | +#ifndef CONFIG_DEBUG_BUGVERBOSE |
| 9 | +#define _BUGVERBOSE_LOCATION(file, line) |
| 10 | +#else |
| 11 | +#define __BUGVERBOSE_LOCATION(file, line) \ |
| 12 | + .pushsection .rodata.str, "aMS", @progbits, 1; \ |
| 13 | + 10002: .string file; \ |
| 14 | + .popsection; \ |
| 15 | + \ |
| 16 | + .long 10002b - .; \ |
| 17 | + .short line; |
| 18 | +#define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line) |
| 19 | +#endif |
6 | 20 |
|
7 |
| -#ifdef CONFIG_BUG |
| 21 | +#ifndef CONFIG_GENERIC_BUG |
| 22 | +#define __BUG_ENTRY(flags) |
| 23 | +#else |
| 24 | +#define __BUG_ENTRY(flags) \ |
| 25 | + .pushsection __bug_table, "aw"; \ |
| 26 | + .align 2; \ |
| 27 | + 10000: .long 10001f - .; \ |
| 28 | + _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ |
| 29 | + .short flags; \ |
| 30 | + .popsection; \ |
| 31 | + 10001: |
| 32 | +#endif |
8 | 33 |
|
9 |
| -#include <asm/break.h> |
| 34 | +#define ASM_BUG_FLAGS(flags) \ |
| 35 | + __BUG_ENTRY(flags) \ |
| 36 | + break BRK_BUG |
10 | 37 |
|
11 |
| -static inline void __noreturn BUG(void) |
12 |
| -{ |
13 |
| - __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); |
14 |
| - unreachable(); |
15 |
| -} |
| 38 | +#define ASM_BUG() ASM_BUG_FLAGS(0) |
16 | 39 |
|
17 |
| -#define HAVE_ARCH_BUG |
| 40 | +#define __BUG_FLAGS(flags) \ |
| 41 | + asm_inline volatile (__stringify(ASM_BUG_FLAGS(flags))); |
18 | 42 |
|
19 |
| -#endif |
| 43 | +#define __WARN_FLAGS(flags) \ |
| 44 | +do { \ |
| 45 | + instrumentation_begin(); \ |
| 46 | + __BUG_FLAGS(BUGFLAG_WARNING|(flags)); \ |
| 47 | + instrumentation_end(); \ |
| 48 | +} while (0) |
| 49 | + |
| 50 | +#define BUG() \ |
| 51 | +do { \ |
| 52 | + instrumentation_begin(); \ |
| 53 | + __BUG_FLAGS(0); \ |
| 54 | + unreachable(); \ |
| 55 | +} while (0) |
| 56 | + |
| 57 | +#define HAVE_ARCH_BUG |
20 | 58 |
|
21 | 59 | #include <asm-generic/bug.h>
|
22 | 60 |
|
|
0 commit comments