Skip to content

Commit 1be1fac

Browse files
author
Peter Zijlstra
committed
x86: Rework __bug_table helpers
Rework the __bug_table helpers such that extension becomes easier. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20251110115757.111187573@infradead.org
1 parent 2ace527 commit 1be1fac

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

  • arch/x86/include/asm

arch/x86/include/asm/bug.h

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,39 +37,42 @@
3737
#ifdef CONFIG_GENERIC_BUG
3838

3939
#ifdef CONFIG_X86_32
40-
# define __BUG_REL(val) ".long " val
40+
#define __BUG_REL(val) ".long " val
4141
#else
42-
# define __BUG_REL(val) ".long " val " - ."
42+
#define __BUG_REL(val) ".long " val " - ."
4343
#endif
4444

4545
#ifdef CONFIG_DEBUG_BUGVERBOSE
46-
#define __BUG_ENTRY(file, line, flags) \
47-
"2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
46+
#define __BUG_ENTRY_VERBOSE(file, line) \
4847
"\t" __BUG_REL(file) "\t# bug_entry::file\n" \
49-
"\t.word " line "\t# bug_entry::line\n" \
50-
"\t.word " flags "\t# bug_entry::flags\n"
48+
"\t.word " line "\t# bug_entry::line\n"
5149
#else
52-
#define __BUG_ENTRY(file, line, flags) \
53-
"2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
54-
"\t.word " flags "\t# bug_entry::flags\n"
50+
#define __BUG_ENTRY_VERBOSE(file, line)
5551
#endif
5652

53+
#define __BUG_ENTRY(file, line, flags) \
54+
__BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
55+
__BUG_ENTRY_VERBOSE(file, line) \
56+
"\t.word " flags "\t# bug_entry::flags\n"
57+
5758
#define _BUG_FLAGS_ASM(ins, file, line, flags, size, extra) \
5859
"1:\t" ins "\n" \
59-
".pushsection __bug_table,\"aw\"\n" \
60+
".pushsection __bug_table,\"aw\"\n\t" \
6061
ANNOTATE_DATA_SPECIAL \
62+
"2:\n\t" \
6163
__BUG_ENTRY(file, line, flags) \
6264
"\t.org 2b + " size "\n" \
6365
".popsection\n" \
6466
extra
6567

66-
#define _BUG_FLAGS(cond_str, ins, flags, extra) \
67-
do { \
68-
asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c0", \
69-
"%c1", "%c2", "%c3", extra) \
70-
: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \
71-
"i" (flags), \
72-
"i" (sizeof(struct bug_entry))); \
68+
#define _BUG_FLAGS(cond_str, ins, flags, extra) \
69+
do { \
70+
asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c0", \
71+
"%c1", "%c2", "%c3", extra) \
72+
: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), \
73+
"i" (__LINE__), \
74+
"i" (flags), \
75+
"i" (sizeof(struct bug_entry))); \
7376
} while (0)
7477

7578
#define ARCH_WARN_ASM(file, line, flags, size) \

0 commit comments

Comments
 (0)