blob: 08ea46863fe5ca8ce6683fe71f527a6c4346b690 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_BUG_H
2#define __ASM_BUG_H
3
Ralf Baechle63dc68a2006-10-16 01:38:50 +01004#include <asm/sgidefs.h>
Ralf Baechlefdb551a2005-05-19 12:08:04 +00005
6#ifdef CONFIG_BUG
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <asm/break.h>
9
David Daney8ec2e242008-11-20 17:26:36 -080010static inline void __noreturn BUG(void)
11{
12 __asm__ __volatile__("break %0" : : "i" (BRK_BUG));
13 /* Fool GCC into thinking the function doesn't return. */
14 while (1)
15 ;
16}
Ralf Baechle8592d4c2005-10-29 19:32:38 +010017
18#define HAVE_ARCH_BUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Ralf Baechle63dc68a2006-10-16 01:38:50 +010020#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
21
David Daney8ec2e242008-11-20 17:26:36 -080022static inline void __BUG_ON(unsigned long condition)
23{
24 if (__builtin_constant_p(condition)) {
25 if (condition)
26 BUG();
27 else
28 return;
29 }
30 __asm__ __volatile__("tne $0, %0, %1"
31 : : "r" (condition), "i" (BRK_BUG));
32}
33
34#define BUG_ON(C) __BUG_ON((unsigned long)(C))
Ralf Baechle63dc68a2006-10-16 01:38:50 +010035
36#define HAVE_ARCH_BUG_ON
37
38#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#endif
Ralf Baechlefdb551a2005-05-19 12:08:04 +000041
Ralf Baechleffd099b2005-05-19 17:05:09 +000042#include <asm-generic/bug.h>
43
Ralf Baechlefdb551a2005-05-19 12:08:04 +000044#endif /* __ASM_BUG_H */