32
32
#ifdef CONFIG_GENERIC_BUG
33
33
34
34
#ifdef CONFIG_X86_32
35
- # define __BUG_REL (val ) ".long " __stringify( val)
35
+ # define __BUG_REL (val ) ".long " val
36
36
#else
37
- # define __BUG_REL (val ) ".long " __stringify( val) " - ."
37
+ # define __BUG_REL (val ) ".long " val " - ."
38
38
#endif
39
39
40
40
#ifdef CONFIG_DEBUG_BUGVERBOSE
41
+ #define __BUG_ENTRY (file , line , flags ) \
42
+ "2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
43
+ "\t" __BUG_REL(file) "\t# bug_entry::file\n" \
44
+ "\t.word " line "\t# bug_entry::line\n" \
45
+ "\t.word " flags "\t# bug_entry::flags\n"
46
+ #else
47
+ #define __BUG_ENTRY (file , line , flags ) \
48
+ "2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
49
+ "\t.word " flags "\t# bug_entry::flags\n"
50
+ #endif
51
+
52
+ #define _BUG_FLAGS_ASM (ins , file , line , flags , size , extra ) \
53
+ "1:\t" ins "\n" \
54
+ ".pushsection __bug_table,\"aw\"\n" \
55
+ __BUG_ENTRY(file, line, flags) \
56
+ "\t.org 2b + " size "\n" \
57
+ ".popsection\n" \
58
+ extra
41
59
42
60
#define _BUG_FLAGS (ins , flags , extra ) \
43
61
do { \
44
- asm_inline volatile("1:\t" ins "\n" \
45
- ".pushsection __bug_table,\"aw\"\n" \
46
- "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
47
- "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \
48
- "\t.word %c1" "\t# bug_entry::line\n" \
49
- "\t.word %c2" "\t# bug_entry::flags\n" \
50
- "\t.org 2b+%c3\n" \
51
- ".popsection\n" \
52
- extra \
62
+ asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c0", \
63
+ "%c1", "%c2", "%c3", extra) \
53
64
: : "i" (__FILE__), "i" (__LINE__), \
54
65
"i" (flags), \
55
66
"i" (sizeof(struct bug_entry))); \
56
67
} while (0)
57
68
58
- #else /* !CONFIG_DEBUG_BUGVERBOSE */
59
-
60
- #define _BUG_FLAGS (ins , flags , extra ) \
61
- do { \
62
- asm_inline volatile("1:\t" ins "\n" \
63
- ".pushsection __bug_table,\"aw\"\n" \
64
- "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
65
- "\t.word %c0" "\t# bug_entry::flags\n" \
66
- "\t.org 2b+%c1\n" \
67
- ".popsection\n" \
68
- extra \
69
- : : "i" (flags), \
70
- "i" (sizeof(struct bug_entry))); \
71
- } while (0)
72
-
73
- #endif /* CONFIG_DEBUG_BUGVERBOSE */
69
+ #define ARCH_WARN_ASM (file , line , flags , size ) \
70
+ _BUG_FLAGS_ASM(ASM_UD2, file, line, flags, size, "")
74
71
75
72
#else
76
73
@@ -92,11 +89,14 @@ do { \
92
89
* were to trigger, we'd rather wreck the machine in an attempt to get the
93
90
* message out than not know about it.
94
91
*/
92
+
93
+ #define ARCH_WARN_REACHABLE ANNOTATE_REACHABLE(1b)
94
+
95
95
#define __WARN_FLAGS (flags ) \
96
96
do { \
97
97
__auto_type __flags = BUGFLAG_WARNING|(flags); \
98
98
instrumentation_begin(); \
99
- _BUG_FLAGS(ASM_UD2, __flags, ANNOTATE_REACHABLE(1b) ); \
99
+ _BUG_FLAGS(ASM_UD2, __flags, ARCH_WARN_REACHABLE ); \
100
100
instrumentation_end(); \
101
101
} while (0)
102
102
0 commit comments