xref: /linux/arch/x86/include/asm/bug.h (revision 3932b9ca55b0be314a36d3e84faff3e823c081f5)
1 #ifndef _ASM_X86_BUG_H
2 #define _ASM_X86_BUG_H
3 
4 #define HAVE_ARCH_BUG
5 
6 #ifdef CONFIG_DEBUG_BUGVERBOSE
7 
8 #ifdef CONFIG_X86_32
9 # define __BUG_C0	"2:\t.long 1b, %c0\n"
10 #else
11 # define __BUG_C0	"2:\t.long 1b - 2b, %c0 - 2b\n"
12 #endif
13 
14 #define BUG()							\
15 do {								\
16 	asm volatile("1:\tud2\n"				\
17 		     ".pushsection __bug_table,\"a\"\n"		\
18 		     __BUG_C0					\
19 		     "\t.word %c1, 0\n"				\
20 		     "\t.org 2b+%c2\n"				\
21 		     ".popsection"				\
22 		     : : "i" (__FILE__), "i" (__LINE__),	\
23 		     "i" (sizeof(struct bug_entry)));		\
24 	unreachable();						\
25 } while (0)
26 
27 #else
28 #define BUG()							\
29 do {								\
30 	asm volatile("ud2");					\
31 	unreachable();						\
32 } while (0)
33 #endif
34 
35 #include <asm-generic/bug.h>
36 
37 #endif /* _ASM_X86_BUG_H */
38