sysdep.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* Generic asm macros used on many machines.
  2. Copyright (C) 1991,92,93,96,98,2002,2003,2009 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifdef __ASSEMBLER__
  17. /* Makros to generate eh_frame unwind information. */
  18. #ifdef HAVE_ASM_CFI_DIRECTIVES
  19. #define cfi_startproc .cfi_startproc
  20. #define cfi_endproc .cfi_endproc
  21. #define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
  22. #define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
  23. #define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
  24. #define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
  25. #define cfi_offset(reg, off) .cfi_offset reg, off
  26. #define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
  27. #define cfi_register(r1, r2) .cfi_register r1, r2
  28. #define cfi_return_column(reg) .cfi_return_column reg
  29. #define cfi_restore(reg) .cfi_restore reg
  30. #define cfi_same_value(reg) .cfi_same_value reg
  31. #define cfi_undefined(reg) .cfi_undefined reg
  32. #define cfi_remember_state .cfi_remember_state
  33. #define cfi_restore_state .cfi_restore_state
  34. #define cfi_window_save .cfi_window_save
  35. #define cfi_personality(enc, exp) .cfi_personality enc, exp
  36. #define cfi_lsda(enc, exp) .cfi_lsda enc, exp
  37. #else
  38. #define cfi_startproc
  39. #define cfi_endproc
  40. #define cfi_def_cfa(reg, off)
  41. #define cfi_def_cfa_register(reg)
  42. #define cfi_def_cfa_offset(off)
  43. #define cfi_adjust_cfa_offset(off)
  44. #define cfi_offset(reg, off)
  45. #define cfi_rel_offset(reg, off)
  46. #define cfi_register(r1, r2)
  47. #define cfi_return_column(reg)
  48. #define cfi_restore(reg)
  49. #define cfi_same_value(reg)
  50. #define cfi_undefined(reg)
  51. #define cfi_remember_state
  52. #define cfi_restore_state
  53. #define cfi_window_save
  54. #define cfi_personality(enc, exp)
  55. #define cfi_lsda(enc, exp)
  56. #endif
  57. #else /* ! ASSEMBLER */
  58. #ifdef HAVE_ASM_CFI_DIRECTIVES
  59. #define CFI_STRINGIFY(Name) CFI_STRINGIFY2(Name)
  60. #define CFI_STRINGIFY2(Name) #Name
  61. #define CFI_STARTPROC ".cfi_startproc"
  62. #define CFI_ENDPROC ".cfi_endproc"
  63. #define CFI_DEF_CFA(reg, off) ".cfi_def_cfa " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
  64. #define CFI_DEF_CFA_REGISTER(reg) ".cfi_def_cfa_register " CFI_STRINGIFY(reg)
  65. #define CFI_DEF_CFA_OFFSET(off) ".cfi_def_cfa_offset " CFI_STRINGIFY(off)
  66. #define CFI_ADJUST_CFA_OFFSET(off) ".cfi_adjust_cfa_offset " CFI_STRINGIFY(off)
  67. #define CFI_OFFSET(reg, off) ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
  68. #define CFI_REL_OFFSET(reg, off) ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
  69. #define CFI_REGISTER(r1, r2) ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)
  70. #define CFI_RETURN_COLUMN(reg) ".cfi_return_column " CFI_STRINGIFY(reg)
  71. #define CFI_RESTORE(reg) ".cfi_restore " CFI_STRINGIFY(reg)
  72. #define CFI_UNDEFINED(reg) ".cfi_undefined " CFI_STRINGIFY(reg)
  73. #define CFI_REMEMBER_STATE ".cfi_remember_state"
  74. #define CFI_RESTORE_STATE ".cfi_restore_state"
  75. #define CFI_WINDOW_SAVE ".cfi_window_save"
  76. #define CFI_PERSONALITY(enc, exp) ".cfi_personality " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
  77. #define CFI_LSDA(enc, exp) ".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
  78. #else
  79. #define CFI_STARTPROC
  80. #define CFI_ENDPROC
  81. #define CFI_DEF_CFA(reg, off)
  82. #define CFI_DEF_CFA_REGISTER(reg)
  83. #define CFI_DEF_CFA_OFFSET(off)
  84. #define CFI_ADJUST_CFA_OFFSET(off)
  85. #define CFI_OFFSET(reg, off)
  86. #define CFI_REL_OFFSET(reg, off)
  87. #define CFI_REGISTER(r1, r2)
  88. #define CFI_RETURN_COLUMN(reg)
  89. #define CFI_RESTORE(reg)
  90. #define CFI_UNDEFINED(reg)
  91. #define CFI_REMEMBER_STATE
  92. #define CFI_RESTORE_STATE
  93. #define CFI_WINDOW_SAVE
  94. #define CFI_PERSONALITY(enc, exp)
  95. #define CFI_LSDA(enc, exp)
  96. #endif
  97. #endif /* __ASSEMBLER__ */
  98. /* Values used for encoding parameter of cfi_personality and cfi_lsda. */
  99. #define DW_EH_PE_absptr 0x00
  100. #define DW_EH_PE_omit 0xff
  101. #define DW_EH_PE_uleb128 0x01
  102. #define DW_EH_PE_udata2 0x02
  103. #define DW_EH_PE_udata4 0x03
  104. #define DW_EH_PE_udata8 0x04
  105. #define DW_EH_PE_sleb128 0x09
  106. #define DW_EH_PE_sdata2 0x0a
  107. #define DW_EH_PE_sdata4 0x0b
  108. #define DW_EH_PE_sdata8 0x0c
  109. #define DW_EH_PE_signed 0x08
  110. #define DW_EH_PE_pcrel 0x10
  111. #define DW_EH_PE_textrel 0x20
  112. #define DW_EH_PE_datarel 0x30
  113. #define DW_EH_PE_funcrel 0x40
  114. #define DW_EH_PE_aligned 0x50
  115. #define DW_EH_PE_indirect 0x80