dwarf2.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef _ASM_X86_DWARF2_H
  2. #define _ASM_X86_DWARF2_H
  3. #ifndef __ASSEMBLY__
  4. #warning "asm/dwarf2.h should be only included in pure assembly files"
  5. #endif
  6. /*
  7. * Macros for dwarf2 CFI unwind table entries.
  8. * See "as.info" for details on these pseudo ops. Unfortunately
  9. * they are only supported in very new binutils, so define them
  10. * away for older version.
  11. */
  12. #ifdef CONFIG_AS_CFI
  13. #define CFI_STARTPROC .cfi_startproc
  14. #define CFI_ENDPROC .cfi_endproc
  15. #define CFI_DEF_CFA .cfi_def_cfa
  16. #define CFI_DEF_CFA_REGISTER .cfi_def_cfa_register
  17. #define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset
  18. #define CFI_ADJUST_CFA_OFFSET .cfi_adjust_cfa_offset
  19. #define CFI_OFFSET .cfi_offset
  20. #define CFI_REL_OFFSET .cfi_rel_offset
  21. #define CFI_REGISTER .cfi_register
  22. #define CFI_RESTORE .cfi_restore
  23. #define CFI_REMEMBER_STATE .cfi_remember_state
  24. #define CFI_RESTORE_STATE .cfi_restore_state
  25. #define CFI_UNDEFINED .cfi_undefined
  26. #define CFI_ESCAPE .cfi_escape
  27. #ifdef CONFIG_AS_CFI_SIGNAL_FRAME
  28. #define CFI_SIGNAL_FRAME .cfi_signal_frame
  29. #else
  30. #define CFI_SIGNAL_FRAME
  31. #endif
  32. #if defined(CONFIG_AS_CFI_SECTIONS) && defined(__ASSEMBLY__)
  33. /*
  34. * Emit CFI data in .debug_frame sections, not .eh_frame sections.
  35. * The latter we currently just discard since we don't do DWARF
  36. * unwinding at runtime. So only the offline DWARF information is
  37. * useful to anyone. Note we should not use this directive if this
  38. * file is used in the vDSO assembly, or if vmlinux.lds.S gets
  39. * changed so it doesn't discard .eh_frame.
  40. */
  41. .cfi_sections .debug_frame
  42. #endif
  43. #else
  44. /*
  45. * Due to the structure of pre-exisiting code, don't use assembler line
  46. * comment character # to ignore the arguments. Instead, use a dummy macro.
  47. */
  48. .macro cfi_ignore a=0, b=0, c=0, d=0
  49. .endm
  50. #define CFI_STARTPROC cfi_ignore
  51. #define CFI_ENDPROC cfi_ignore
  52. #define CFI_DEF_CFA cfi_ignore
  53. #define CFI_DEF_CFA_REGISTER cfi_ignore
  54. #define CFI_DEF_CFA_OFFSET cfi_ignore
  55. #define CFI_ADJUST_CFA_OFFSET cfi_ignore
  56. #define CFI_OFFSET cfi_ignore
  57. #define CFI_REL_OFFSET cfi_ignore
  58. #define CFI_REGISTER cfi_ignore
  59. #define CFI_RESTORE cfi_ignore
  60. #define CFI_REMEMBER_STATE cfi_ignore
  61. #define CFI_RESTORE_STATE cfi_ignore
  62. #define CFI_UNDEFINED cfi_ignore
  63. #define CFI_ESCAPE cfi_ignore
  64. #define CFI_SIGNAL_FRAME cfi_ignore
  65. #endif
  66. /*
  67. * An attempt to make CFI annotations more or less
  68. * correct and shorter. It is implied that you know
  69. * what you're doing if you use them.
  70. */
  71. #ifdef __ASSEMBLY__
  72. #ifdef CONFIG_X86_64
  73. .macro pushq_cfi reg
  74. pushq \reg
  75. CFI_ADJUST_CFA_OFFSET 8
  76. .endm
  77. .macro popq_cfi reg
  78. popq \reg
  79. CFI_ADJUST_CFA_OFFSET -8
  80. .endm
  81. .macro pushfq_cfi
  82. pushfq
  83. CFI_ADJUST_CFA_OFFSET 8
  84. .endm
  85. .macro popfq_cfi
  86. popfq
  87. CFI_ADJUST_CFA_OFFSET -8
  88. .endm
  89. .macro movq_cfi reg offset=0
  90. movq %\reg, \offset(%rsp)
  91. CFI_REL_OFFSET \reg, \offset
  92. .endm
  93. .macro movq_cfi_restore offset reg
  94. movq \offset(%rsp), %\reg
  95. CFI_RESTORE \reg
  96. .endm
  97. #else /*!CONFIG_X86_64*/
  98. .macro pushl_cfi reg
  99. pushl \reg
  100. CFI_ADJUST_CFA_OFFSET 4
  101. .endm
  102. .macro popl_cfi reg
  103. popl \reg
  104. CFI_ADJUST_CFA_OFFSET -4
  105. .endm
  106. .macro pushfl_cfi
  107. pushfl
  108. CFI_ADJUST_CFA_OFFSET 4
  109. .endm
  110. .macro popfl_cfi
  111. popfl
  112. CFI_ADJUST_CFA_OFFSET -4
  113. .endm
  114. .macro movl_cfi reg offset=0
  115. movl %\reg, \offset(%esp)
  116. CFI_REL_OFFSET \reg, \offset
  117. .endm
  118. .macro movl_cfi_restore offset reg
  119. movl \offset(%esp), %\reg
  120. CFI_RESTORE \reg
  121. .endm
  122. #endif /*!CONFIG_X86_64*/
  123. #endif /*__ASSEMBLY__*/
  124. #endif /* _ASM_X86_DWARF2_H */