bug.h 759 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_BUG_H
  3. #define __ASM_BUG_H
  4. #include <linux/compiler.h>
  5. #include <asm/sgidefs.h>
  6. #ifdef CONFIG_BUG
  7. #include <asm/break.h>
  8. static inline void __noreturn BUG(void)
  9. {
  10. __asm__ __volatile__("break %0" : : "i" (BRK_BUG));
  11. unreachable();
  12. }
  13. #define HAVE_ARCH_BUG
  14. #if (_MIPS_ISA > _MIPS_ISA_MIPS1)
  15. static inline void __BUG_ON(unsigned long condition)
  16. {
  17. if (__builtin_constant_p(condition)) {
  18. if (condition)
  19. BUG();
  20. else
  21. return;
  22. }
  23. __asm__ __volatile__("tne $0, %0, %1"
  24. : : "r" (condition), "i" (BRK_BUG));
  25. }
  26. #define BUG_ON(C) __BUG_ON((unsigned long)(C))
  27. #define HAVE_ARCH_BUG_ON
  28. #endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
  29. #endif
  30. #include <asm-generic/bug.h>
  31. #endif /* __ASM_BUG_H */