bug.h 847 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef __ASM_X8664_BUG_H
  2. #define __ASM_X8664_BUG_H 1
  3. #include <linux/stringify.h>
  4. /*
  5. * Tell the user there is some problem. The exception handler decodes
  6. * this frame.
  7. */
  8. struct bug_frame {
  9. unsigned char ud2[2];
  10. unsigned char push;
  11. signed int filename;
  12. unsigned char ret;
  13. unsigned short line;
  14. } __attribute__((packed));
  15. #ifdef CONFIG_BUG
  16. #define HAVE_ARCH_BUG
  17. /* We turn the bug frame into valid instructions to not confuse
  18. the disassembler. Thanks to Jan Beulich & Suresh Siddha
  19. for nice instruction selection.
  20. The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
  21. #define BUG() \
  22. asm volatile( \
  23. "ud2 ; pushq $%c1 ; ret $%c0" :: \
  24. "i"(__LINE__), "i" (__FILE__))
  25. void out_of_line_bug(void);
  26. #else
  27. static inline void out_of_line_bug(void) { }
  28. #endif
  29. #include <asm-generic/bug.h>
  30. #endif