| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_BUG_H |
| 2 | #define __ASM_BUG_H | ||||
| 3 | |||||
| Ralf Baechle | 0ca5921 | 2009-06-19 13:51:28 +0100 | [diff] [blame] | 4 | #include <linux/compiler.h> |
| Ralf Baechle | 63dc68a | 2006-10-16 01:38:50 +0100 | [diff] [blame] | 5 | #include <asm/sgidefs.h> |
| Ralf Baechle | fdb551a | 2005-05-19 12:08:04 +0000 | [diff] [blame] | 6 | |
| 7 | #ifdef CONFIG_BUG | ||||
| 8 | |||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <asm/break.h> |
| 10 | |||||
| David Daney | 8ec2e24 | 2008-11-20 17:26:36 -0800 | [diff] [blame] | 11 | static inline void __noreturn BUG(void) |
| 12 | { | ||||
| 13 | __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); | ||||
| David Daney | 4ef5651 | 2009-12-04 17:44:52 -0800 | [diff] [blame^] | 14 | unreachable(); |
| David Daney | 8ec2e24 | 2008-11-20 17:26:36 -0800 | [diff] [blame] | 15 | } |
| Ralf Baechle | 8592d4c | 2005-10-29 19:32:38 +0100 | [diff] [blame] | 16 | |
| 17 | #define HAVE_ARCH_BUG | ||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
| Ralf Baechle | 63dc68a | 2006-10-16 01:38:50 +0100 | [diff] [blame] | 19 | #if (_MIPS_ISA > _MIPS_ISA_MIPS1) |
| 20 | |||||
| David Daney | 8ec2e24 | 2008-11-20 17:26:36 -0800 | [diff] [blame] | 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)) | ||||
| Ralf Baechle | 63dc68a | 2006-10-16 01:38:50 +0100 | [diff] [blame] | 34 | |
| 35 | #define HAVE_ARCH_BUG_ON | ||||
| 36 | |||||
| 37 | #endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */ | ||||
| 38 | |||||
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #endif |
| Ralf Baechle | fdb551a | 2005-05-19 12:08:04 +0000 | [diff] [blame] | 40 | |
| Ralf Baechle | ffd099b | 2005-05-19 17:05:09 +0000 | [diff] [blame] | 41 | #include <asm-generic/bug.h> |
| 42 | |||||
| Ralf Baechle | fdb551a | 2005-05-19 12:08:04 +0000 | [diff] [blame] | 43 | #endif /* __ASM_BUG_H */ |