blob: 6cf29c26e873788a78221ab517dc97cc6ae5386c [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));
14 /* Fool GCC into thinking the function doesn't return. */
15 while (1)
16 ;
17}
Ralf Baechle8592d4c2005-10-29 19:32:38 +010018
19#define HAVE_ARCH_BUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
Ralf Baechle63dc68a2006-10-16 01:38:50 +010021#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
22
David Daney8ec2e242008-11-20 17:26:36 -080023static inline void __BUG_ON(unsigned long condition)
24{
25 if (__builtin_constant_p(condition)) {
26 if (condition)
27 BUG();
28 else
29 return;
30 }
31 __asm__ __volatile__("tne $0, %0, %1"
32 : : "r" (condition), "i" (BRK_BUG));
33}
34
35#define BUG_ON(C) __BUG_ON((unsigned long)(C))
Ralf Baechle63dc68a2006-10-16 01:38:50 +010036
37#define HAVE_ARCH_BUG_ON
38
39#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
40
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#endif
Ralf Baechlefdb551a2005-05-19 12:08:04 +000042
Ralf Baechleffd099b2005-05-19 17:05:09 +000043#include <asm-generic/bug.h>
44
Ralf Baechlefdb551a2005-05-19 12:08:04 +000045#endif /* __ASM_BUG_H */