| .. | .. |
|---|
| 3 | 3 | #define _ASM_X86_BUG_H |
|---|
| 4 | 4 | |
|---|
| 5 | 5 | #include <linux/stringify.h> |
|---|
| 6 | +#include <linux/instrumentation.h> |
|---|
| 6 | 7 | |
|---|
| 7 | 8 | /* |
|---|
| 8 | 9 | * Despite that some emulators terminate on UD2, we use it for WARN(). |
|---|
| .. | .. |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | #define _BUG_FLAGS(ins, flags) \ |
|---|
| 34 | 35 | do { \ |
|---|
| 35 | | - asm volatile("1:\t" ins "\n" \ |
|---|
| 36 | + asm_inline volatile("1:\t" ins "\n" \ |
|---|
| 36 | 37 | ".pushsection __bug_table,\"aw\"\n" \ |
|---|
| 37 | 38 | "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ |
|---|
| 38 | 39 | "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ |
|---|
| .. | .. |
|---|
| 49 | 50 | |
|---|
| 50 | 51 | #define _BUG_FLAGS(ins, flags) \ |
|---|
| 51 | 52 | do { \ |
|---|
| 52 | | - asm volatile("1:\t" ins "\n" \ |
|---|
| 53 | + asm_inline volatile("1:\t" ins "\n" \ |
|---|
| 53 | 54 | ".pushsection __bug_table,\"aw\"\n" \ |
|---|
| 54 | 55 | "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ |
|---|
| 55 | 56 | "\t.word %c0" "\t# bug_entry::flags\n" \ |
|---|
| .. | .. |
|---|
| 70 | 71 | #define HAVE_ARCH_BUG |
|---|
| 71 | 72 | #define BUG() \ |
|---|
| 72 | 73 | do { \ |
|---|
| 74 | + instrumentation_begin(); \ |
|---|
| 73 | 75 | _BUG_FLAGS(ASM_UD2, 0); \ |
|---|
| 74 | 76 | unreachable(); \ |
|---|
| 75 | 77 | } while (0) |
|---|
| 76 | 78 | |
|---|
| 79 | +/* |
|---|
| 80 | + * This instrumentation_begin() is strictly speaking incorrect; but it |
|---|
| 81 | + * suppresses the complaints from WARN()s in noinstr code. If such a WARN() |
|---|
| 82 | + * were to trigger, we'd rather wreck the machine in an attempt to get the |
|---|
| 83 | + * message out than not know about it. |
|---|
| 84 | + */ |
|---|
| 77 | 85 | #define __WARN_FLAGS(flags) \ |
|---|
| 78 | 86 | do { \ |
|---|
| 87 | + instrumentation_begin(); \ |
|---|
| 79 | 88 | _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \ |
|---|
| 80 | 89 | annotate_reachable(); \ |
|---|
| 90 | + instrumentation_end(); \ |
|---|
| 81 | 91 | } while (0) |
|---|
| 82 | 92 | |
|---|
| 83 | 93 | #include <asm-generic/bug.h> |
|---|