asm-bug.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __ASM_ASM_BUG_H
  2. /*
  3. * Copyright (C) 2017 ARM Limited
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #define __ASM_ASM_BUG_H
  18. #include <asm/brk-imm.h>
  19. #ifdef CONFIG_DEBUG_BUGVERBOSE
  20. #define _BUGVERBOSE_LOCATION(file, line) __BUGVERBOSE_LOCATION(file, line)
  21. #define __BUGVERBOSE_LOCATION(file, line) \
  22. .pushsection .rodata.str,"aMS",@progbits,1; \
  23. 14472: .string file; \
  24. .popsection; \
  25. \
  26. .long 14472b - 14470b; \
  27. .short line;
  28. #else
  29. #define _BUGVERBOSE_LOCATION(file, line)
  30. #endif
  31. #ifdef CONFIG_GENERIC_BUG
  32. #define __BUG_ENTRY(flags) \
  33. .pushsection __bug_table,"aw"; \
  34. .align 2; \
  35. 14470: .long 14471f - 14470b; \
  36. _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
  37. .short flags; \
  38. .popsection; \
  39. 14471:
  40. #else
  41. #define __BUG_ENTRY(flags)
  42. #endif
  43. #define ASM_BUG_FLAGS(flags) \
  44. __BUG_ENTRY(flags) \
  45. brk BUG_BRK_IMM
  46. #define ASM_BUG() ASM_BUG_FLAGS(0)
  47. #endif /* __ASM_ASM_BUG_H */