blob: ba38ebbaced3cd0224caef932f3f59a5cc2cc5cf [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_BUG_H
2#define _ASM_X86_BUG_H
Thomas Gleixner68fdc552007-10-17 17:19:30 +02003
Thomas Gleixner68fdc552007-10-17 17:19:30 +02004#define HAVE_ARCH_BUG
5
6#ifdef CONFIG_DEBUG_BUGVERBOSE
7
Thomas Gleixner96a388d2007-10-11 11:20:03 +02008#ifdef CONFIG_X86_32
Thomas Gleixner68fdc552007-10-17 17:19:30 +02009# define __BUG_C0 "2:\t.long 1b, %c0\n"
Thomas Gleixner96a388d2007-10-11 11:20:03 +020010#else
Jan Beulichb93a5312008-12-16 11:40:27 +000011# define __BUG_C0 "2:\t.long 1b - 2b, %c0 - 2b\n"
Thomas Gleixner68fdc552007-10-17 17:19:30 +020012#endif
13
Joe Perches86d8a082008-03-23 01:01:46 -070014#define BUG() \
15do { \
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))); \
David Daneya5fc5eb2009-12-04 17:44:51 -080024 unreachable(); \
Joe Perches86d8a082008-03-23 01:01:46 -070025} while (0)
Thomas Gleixner68fdc552007-10-17 17:19:30 +020026
27#else
Joe Perches86d8a082008-03-23 01:01:46 -070028#define BUG() \
29do { \
30 asm volatile("ud2"); \
David Daneya5fc5eb2009-12-04 17:44:51 -080031 unreachable(); \
Joe Perches86d8a082008-03-23 01:01:46 -070032} while (0)
Thomas Gleixner68fdc552007-10-17 17:19:30 +020033#endif
34
Thomas Gleixner68fdc552007-10-17 17:19:30 +020035#include <asm-generic/bug.h>
David Howellsf05e7982012-03-28 18:11:12 +010036
H. Peter Anvin1965aae2008-10-22 22:26:29 -070037#endif /* _ASM_X86_BUG_H */