bug.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _ASM_S390_BUG_H
  2. #define _ASM_S390_BUG_H
  3. #include <linux/kernel.h>
  4. #ifdef CONFIG_BUG
  5. #ifdef CONFIG_DEBUG_BUGVERBOSE
  6. #define __EMIT_BUG(x) do { \
  7. asm volatile( \
  8. "0: j 0b+2\n" \
  9. "1:\n" \
  10. ".section .rodata.str,\"aMS\",@progbits,1\n" \
  11. "2: .asciz \""__FILE__"\"\n" \
  12. ".previous\n" \
  13. ".section __bug_table,\"a\"\n" \
  14. "3: .long 1b-3b,2b-3b\n" \
  15. " .short %0,%1\n" \
  16. " .org 3b+%2\n" \
  17. ".previous\n" \
  18. : : "i" (__LINE__), \
  19. "i" (x), \
  20. "i" (sizeof(struct bug_entry))); \
  21. } while (0)
  22. #else /* CONFIG_DEBUG_BUGVERBOSE */
  23. #define __EMIT_BUG(x) do { \
  24. asm volatile( \
  25. "0: j 0b+2\n" \
  26. "1:\n" \
  27. ".section __bug_table,\"a\"\n" \
  28. "2: .long 1b-2b\n" \
  29. " .short %0\n" \
  30. " .org 2b+%1\n" \
  31. ".previous\n" \
  32. : : "i" (x), \
  33. "i" (sizeof(struct bug_entry))); \
  34. } while (0)
  35. #endif /* CONFIG_DEBUG_BUGVERBOSE */
  36. #define BUG() do { \
  37. __EMIT_BUG(0); \
  38. unreachable(); \
  39. } while (0)
  40. #define __WARN_TAINT(taint) do { \
  41. __EMIT_BUG(BUGFLAG_TAINT(taint)); \
  42. } while (0)
  43. #define WARN_ON(x) ({ \
  44. int __ret_warn_on = !!(x); \
  45. if (__builtin_constant_p(__ret_warn_on)) { \
  46. if (__ret_warn_on) \
  47. __WARN(); \
  48. } else { \
  49. if (unlikely(__ret_warn_on)) \
  50. __WARN(); \
  51. } \
  52. unlikely(__ret_warn_on); \
  53. })
  54. #define HAVE_ARCH_BUG
  55. #define HAVE_ARCH_WARN_ON
  56. #endif /* CONFIG_BUG */
  57. #include <asm-generic/bug.h>
  58. #endif /* _ASM_S390_BUG_H */