bug.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _BLACKFIN_BUG_H
  2. #define _BLACKFIN_BUG_H
  3. #ifdef CONFIG_BUG
  4. #define BFIN_BUG_OPCODE 0xefcd
  5. #ifdef CONFIG_DEBUG_BUGVERBOSE
  6. #define _BUG_OR_WARN(flags) \
  7. asm volatile( \
  8. "1: .hword %0\n" \
  9. " .section __bug_table,\"a\",@progbits\n" \
  10. "2: .long 1b\n" \
  11. " .long %1\n" \
  12. " .short %2\n" \
  13. " .short %3\n" \
  14. " .org 2b + %4\n" \
  15. " .previous" \
  16. : \
  17. : "i"(BFIN_BUG_OPCODE), "i"(__FILE__), \
  18. "i"(__LINE__), "i"(flags), \
  19. "i"(sizeof(struct bug_entry)))
  20. #else
  21. #define _BUG_OR_WARN(flags) \
  22. asm volatile( \
  23. "1: .hword %0\n" \
  24. " .section __bug_table,\"a\",@progbits\n" \
  25. "2: .long 1b\n" \
  26. " .short %1\n" \
  27. " .org 2b + %2\n" \
  28. " .previous" \
  29. : \
  30. : "i"(BFIN_BUG_OPCODE), "i"(flags), \
  31. "i"(sizeof(struct bug_entry)))
  32. #endif /* CONFIG_DEBUG_BUGVERBOSE */
  33. #define BUG() \
  34. do { \
  35. _BUG_OR_WARN(0); \
  36. for (;;); \
  37. } while (0)
  38. #define WARN_ON(condition) \
  39. ({ \
  40. int __ret_warn_on = !!(condition); \
  41. if (unlikely(__ret_warn_on)) \
  42. _BUG_OR_WARN(BUGFLAG_WARNING); \
  43. unlikely(__ret_warn_on); \
  44. })
  45. #define HAVE_ARCH_BUG
  46. #define HAVE_ARCH_WARN_ON
  47. #endif
  48. #include <asm-generic/bug.h>
  49. #endif