summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2024-10-07 10:16:56 +0200
committerPeter Zijlstra <peterz@infradead.org>2025-11-21 11:21:30 +0100
commit1be1fac648fe6184ef3d9a4b60a95eb53bffb0ee (patch)
treef0539a834d2c853ca55098ec43a5adadea76984b
parent2ace52718376fdb56aca863da2eebe70d7e2ddb1 (diff)
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
-rw-r--r--arch/x86/include/asm/bug.h37
1 files changed, 20 insertions, 17 deletions
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 3910db28e2f5..27e3861cf984 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -37,39 +37,42 @@
#ifdef CONFIG_GENERIC_BUG
#ifdef CONFIG_X86_32
-# define __BUG_REL(val) ".long " val
+#define __BUG_REL(val) ".long " val
#else
-# define __BUG_REL(val) ".long " val " - ."
+#define __BUG_REL(val) ".long " val " - ."
#endif
#ifdef CONFIG_DEBUG_BUGVERBOSE
-#define __BUG_ENTRY(file, line, flags) \
- "2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
+#define __BUG_ENTRY_VERBOSE(file, line) \
"\t" __BUG_REL(file) "\t# bug_entry::file\n" \
- "\t.word " line "\t# bug_entry::line\n" \
- "\t.word " flags "\t# bug_entry::flags\n"
+ "\t.word " line "\t# bug_entry::line\n"
#else
-#define __BUG_ENTRY(file, line, flags) \
- "2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
- "\t.word " flags "\t# bug_entry::flags\n"
+#define __BUG_ENTRY_VERBOSE(file, line)
#endif
+#define __BUG_ENTRY(file, line, flags) \
+ __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \
+ __BUG_ENTRY_VERBOSE(file, line) \
+ "\t.word " flags "\t# bug_entry::flags\n"
+
#define _BUG_FLAGS_ASM(ins, file, line, flags, size, extra) \
"1:\t" ins "\n" \
- ".pushsection __bug_table,\"aw\"\n" \
+ ".pushsection __bug_table,\"aw\"\n\t" \
ANNOTATE_DATA_SPECIAL \
+ "2:\n\t" \
__BUG_ENTRY(file, line, flags) \
"\t.org 2b + " size "\n" \
".popsection\n" \
extra
-#define _BUG_FLAGS(cond_str, ins, flags, extra) \
-do { \
- asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c0", \
- "%c1", "%c2", "%c3", extra) \
- : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \
- "i" (flags), \
- "i" (sizeof(struct bug_entry))); \
+#define _BUG_FLAGS(cond_str, ins, flags, extra) \
+do { \
+ asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c0", \
+ "%c1", "%c2", "%c3", extra) \
+ : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), \
+ "i" (__LINE__), \
+ "i" (flags), \
+ "i" (sizeof(struct bug_entry))); \
} while (0)
#define ARCH_WARN_ASM(file, line, flags, size) \