bug.h 1.5 KB

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