bug.h 957 B

123456789101112131415161718192021222324252627282930313233343536
  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 mov;
  11. /* should use 32bit offset instead, but the assembler doesn't
  12. like it */
  13. char *filename;
  14. unsigned char ret;
  15. unsigned short line;
  16. } __attribute__((packed));
  17. #ifdef CONFIG_BUG
  18. #define HAVE_ARCH_BUG
  19. /* We turn the bug frame into valid instructions to not confuse
  20. the disassembler. Thanks to Jan Beulich & Suresh Siddha
  21. for nice instruction selection.
  22. The magic numbers generate mov $64bitimm,%eax ; ret $offset. */
  23. #define BUG() \
  24. asm volatile( \
  25. "ud2 ; .byte 0xa3 ; .quad %c1 ; .byte 0xc2 ; .short %c0" :: \
  26. "i"(__LINE__), "i" (__stringify(__FILE__)))
  27. void out_of_line_bug(void);
  28. #else
  29. static inline void out_of_line_bug(void) { }
  30. #endif
  31. #include <asm-generic/bug.h>
  32. #endif