xref: /linux/arch/mips/include/asm/bug.h (revision 9e9f60108423f18a99c9cc93ef7f23490ecc709b)
1 #ifndef __ASM_BUG_H
2 #define __ASM_BUG_H
3 
4 #include <linux/compiler.h>
5 #include <asm/sgidefs.h>
6 
7 #ifdef CONFIG_BUG
8 
9 #include <asm/break.h>
10 
11 static inline void __noreturn BUG(void)
12 {
13 	__asm__ __volatile__("break %0" : : "i" (BRK_BUG));
14 	unreachable();
15 }
16 
17 #define HAVE_ARCH_BUG
18 
19 #if (_MIPS_ISA > _MIPS_ISA_MIPS1)
20 
21 static 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))
34 
35 #define HAVE_ARCH_BUG_ON
36 
37 #endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
38 
39 #endif
40 
41 #include <asm-generic/bug.h>
42 
43 #endif /* __ASM_BUG_H */
44