Commit 1be1fac6 authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

x86: Rework __bug_table helpers



Rework the __bug_table helpers such that extension becomes easier.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251110115757.111187573@infradead.org
parent 2ace5271
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -43,21 +43,23 @@
#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_VERBOSE(file, line)
#endif

#define __BUG_ENTRY(file, line, flags)					\
	"2:\t" __BUG_REL("1b") "\t# bug_entry::bug_addr\n"		\
	__BUG_REL("1b")		"\t# bug_entry::bug_addr\n"		\
	__BUG_ENTRY_VERBOSE(file, line)					\
	"\t.word " flags	"\t# bug_entry::flags\n"
#endif

#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"							\
@@ -67,7 +69,8 @@
do {									\
	asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c0",			\
					   "%c1", "%c2", "%c3", extra)	\
		     : : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__),	\
		   : : "i" (WARN_CONDITION_STR(cond_str) __FILE__),	\
		       "i" (__LINE__),					\
		       "i" (flags),					\
		       "i" (sizeof(struct bug_entry)));			\
} while (0)