bug.h 758 字节
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6
#ifndef _I386_BUG_H
#define _I386_BUG_H


/*
 * Tell the user there is some problem.
J
Jeremy Fitzhardinge 已提交
7
 * The offending file and line are encoded encoded in the __bug_table section.
L
Linus Torvalds 已提交
8 9
 */

M
Matt Mackall 已提交
10 11
#ifdef CONFIG_BUG
#define HAVE_ARCH_BUG
J
Jeremy Fitzhardinge 已提交
12

L
Linus Torvalds 已提交
13
#ifdef CONFIG_DEBUG_BUGVERBOSE
J
Jeremy Fitzhardinge 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26
#define BUG()								\
	do {								\
		asm volatile("1:\tud2\n"				\
			     ".pushsection __bug_table,\"a\"\n"		\
			     "2:\t.long 1b, %c0\n"			\
			     "\t.word %c1, 0\n"				\
			     "\t.org 2b+%c2\n"				\
			     ".popsection"				\
			     : : "i" (__FILE__), "i" (__LINE__),	\
			     "i" (sizeof(struct bug_entry)));		\
		for(;;) ;						\
	} while(0)

L
Linus Torvalds 已提交
27
#else
J
Jeremy Fitzhardinge 已提交
28 29 30 31 32
#define BUG()								\
	do {								\
		asm volatile("ud2");					\
		for(;;) ;						\
	} while(0)
L
Linus Torvalds 已提交
33
#endif
M
Matt Mackall 已提交
34
#endif
L
Linus Torvalds 已提交
35 36 37

#include <asm-generic/bug.h>
#endif