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