blob: 745dc160a069ff3a9509fe4b00a6e2e22b6690dd [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#ifndef __ASM_BUG_H
3#define __ASM_BUG_H
4
Ralf Baechle0ca59212009-06-19 13:51:28 +01005#include <linux/compiler.h>
Ralf Baechle63dc68a2006-10-16 01:38:50 +01006#include <asm/sgidefs.h>
Ralf Baechlefdb551a2005-05-19 12:08:04 +00007
8#ifdef CONFIG_BUG
9
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <asm/break.h>
11
David Daney8ec2e242008-11-20 17:26:36 -080012static inline void __noreturn BUG(void)
13{
14 __asm__ __volatile__("break %0" : : "i" (BRK_BUG));
David Daney4ef56512009-12-04 17:44:52 -080015 unreachable();
David Daney8ec2e242008-11-20 17:26:36 -080016}
Ralf Baechle8592d4c2005-10-29 19:32:38 +010017
18#define HAVE_ARCH_BUG
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Ralf Baechle63dc68a2006-10-16 01:38:50 +010020#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
21
David Daney8ec2e242008-11-20 17:26:36 -080022static inline void __BUG_ON(unsigned long condition)
23{
24 if (__builtin_constant_p(condition)) {
25 if (condition)
26 BUG();
27 else
28 return;
29 }
30 __asm__ __volatile__("tne $0, %0, %1"
31 : : "r" (condition), "i" (BRK_BUG));
32}
33
34#define BUG_ON(C) __BUG_ON((unsigned long)(C))
Ralf Baechle63dc68a2006-10-16 01:38:50 +010035
36#define HAVE_ARCH_BUG_ON
37
38#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040#endif
Ralf Baechlefdb551a2005-05-19 12:08:04 +000041
Ralf Baechleffd099b2005-05-19 17:05:09 +000042#include <asm-generic/bug.h>
43
Ralf Baechlefdb551a2005-05-19 12:08:04 +000044#endif /* __ASM_BUG_H */