blob: 540c98a810d1bce2639e65f09610651ee3fb8aff [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_BUG_H
2#define __ASM_BUG_H
3
Ralf Baechle0ca59212009-06-19 13:51:28 +01004#include <linux/compiler.h>
Ralf Baechle63dc68a2006-10-16 01:38:50 +01005#include <asm/sgidefs.h>
Ralf Baechlefdb551a2005-05-19 12:08:04 +00006
7#ifdef CONFIG_BUG
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <asm/break.h>
10
David Daney8ec2e242008-11-20 17:26:36 -080011static inline void __noreturn BUG(void)
12{
13 __asm__ __volatile__("break %0" : : "i" (BRK_BUG));
David Daney4ef56512009-12-04 17:44:52 -080014 unreachable();
David Daney8ec2e242008-11-20 17:26:36 -080015}
Ralf Baechle8592d4c2005-10-29 19:32:38 +010016
17#define HAVE_ARCH_BUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Ralf Baechle63dc68a2006-10-16 01:38:50 +010019#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
20
David Daney8ec2e242008-11-20 17:26:36 -080021static inline void __BUG_ON(unsigned long condition)
22{
23 if (__builtin_constant_p(condition)) {
24 if (condition)
25 BUG();
26 else
27 return;
28 }
29 __asm__ __volatile__("tne $0, %0, %1"
30 : : "r" (condition), "i" (BRK_BUG));
31}
32
33#define BUG_ON(C) __BUG_ON((unsigned long)(C))
Ralf Baechle63dc68a2006-10-16 01:38:50 +010034
35#define HAVE_ARCH_BUG_ON
36
37#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
38
Linus Torvalds1da177e2005-04-16 15:20:36 -070039#endif
Ralf Baechlefdb551a2005-05-19 12:08:04 +000040
Ralf Baechleffd099b2005-05-19 17:05:09 +000041#include <asm-generic/bug.h>
42
Ralf Baechlefdb551a2005-05-19 12:08:04 +000043#endif /* __ASM_BUG_H */