xref: /openbmc/linux/arch/mips/include/asm/bug.h (revision e8e0929d)
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 	/* Fool GCC into thinking the function doesn't return. */
15 	while (1)
16 		;
17 }
18 
19 #define HAVE_ARCH_BUG
20 
21 #if (_MIPS_ISA > _MIPS_ISA_MIPS1)
22 
23 static 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))
36 
37 #define HAVE_ARCH_BUG_ON
38 
39 #endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
40 
41 #endif
42 
43 #include <asm-generic/bug.h>
44 
45 #endif /* __ASM_BUG_H */
46