Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/bug: Add BUG_FORMAT basics

Opt-in to BUG_FORMAT for x86_64, adjust the BUGTABLE helper and for
now, just store NULL pointers.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251110115757.980264454@infradead.org

+21 -10
+21 -10
arch/x86/include/asm/bug.h
··· 50 50 #define __BUG_ENTRY_VERBOSE(file, line) 51 51 #endif 52 52 53 - #define __BUG_ENTRY(file, line, flags) \ 53 + #if defined(CONFIG_X86_64) || defined(CONFIG_DEBUG_BUGVERBOSE_DETAILED) 54 + #define HAVE_ARCH_BUG_FORMAT 55 + #define __BUG_ENTRY_FORMAT(format) \ 56 + "\t" __BUG_REL(format) "\t# bug_entry::format\n" 57 + #else 58 + #define __BUG_ENTRY_FORMAT(format) 59 + #endif 60 + 61 + #define __BUG_ENTRY(format, file, line, flags) \ 54 62 __BUG_REL("1b") "\t# bug_entry::bug_addr\n" \ 63 + __BUG_ENTRY_FORMAT(format) \ 55 64 __BUG_ENTRY_VERBOSE(file, line) \ 56 65 "\t.word " flags "\t# bug_entry::flags\n" 57 66 58 - #define _BUG_FLAGS_ASM(ins, file, line, flags, size, extra) \ 67 + #define _BUG_FLAGS_ASM(ins, format, file, line, flags, size, extra) \ 59 68 "1:\t" ins "\n" \ 60 69 ".pushsection __bug_table,\"aw\"\n\t" \ 61 70 ANNOTATE_DATA_SPECIAL \ 62 71 "2:\n\t" \ 63 - __BUG_ENTRY(file, line, flags) \ 72 + __BUG_ENTRY(format, file, line, flags) \ 64 73 "\t.org 2b + " size "\n" \ 65 74 ".popsection\n" \ 66 75 extra 67 76 68 77 #define _BUG_FLAGS(cond_str, ins, flags, extra) \ 69 78 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))); \ 79 + asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c[fmt]", "%c[file]", \ 80 + "%c[line]", "%c[fl]", \ 81 + "%c[size]", extra) \ 82 + : : [fmt] "i" (NULL), \ 83 + [file] "i" (WARN_CONDITION_STR(cond_str) __FILE__), \ 84 + [line] "i" (__LINE__), \ 85 + [fl] "i" (flags), \ 86 + [size] "i" (sizeof(struct bug_entry))); \ 76 87 } while (0) 77 88 78 89 #define ARCH_WARN_ASM(file, line, flags, size) \ 79 - _BUG_FLAGS_ASM(ASM_UD2, file, line, flags, size, "") 90 + _BUG_FLAGS_ASM(ASM_UD2, "0", file, line, flags, size, "") 80 91 81 92 #else 82 93