sysdep.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /* Generic asm macros used on many machines.
  2. Copyright (C) 1991,92,93,96,98,2002,2003 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. #include <sys/syscall.h>
  17. #ifndef C_LABEL
  18. /* Define a macro we can use to construct the asm name for a C symbol. */
  19. #ifndef __UCLIBC_UNDERSCORES__
  20. #ifdef __STDC__
  21. #define C_LABEL(name) name##:
  22. #else
  23. #define C_LABEL(name) name/**/:
  24. #endif
  25. #else
  26. #ifdef __STDC__
  27. #define C_LABEL(name) _##name##:
  28. #else
  29. #define C_LABEL(name) _/**/name/**/:
  30. #endif
  31. #endif
  32. #endif
  33. #ifdef __ASSEMBLER__
  34. /* Mark the end of function named SYM. This is used on some platforms
  35. to generate correct debugging information. */
  36. #ifndef END
  37. #define END(sym)
  38. #endif
  39. #ifndef JUMPTARGET
  40. #define JUMPTARGET(sym) sym
  41. #endif
  42. /* Macros to generate eh_frame unwind information. */
  43. # ifdef HAVE_ASM_CFI_DIRECTIVES
  44. # define cfi_sections(sect...) .cfi_sections sect
  45. # define cfi_startproc .cfi_startproc
  46. # define cfi_endproc .cfi_endproc
  47. # define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off
  48. # define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg
  49. # define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off
  50. # define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off
  51. # define cfi_offset(reg, off) .cfi_offset reg, off
  52. # define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off
  53. # define cfi_register(r1, r2) .cfi_register r1, r2
  54. # define cfi_return_column(reg) .cfi_return_column reg
  55. # define cfi_restore(reg) .cfi_restore reg
  56. # define cfi_same_value(reg) .cfi_same_value reg
  57. # define cfi_undefined(reg) .cfi_undefined reg
  58. # define cfi_remember_state .cfi_remember_state
  59. # define cfi_restore_state .cfi_restore_state
  60. # define cfi_window_save .cfi_window_save
  61. # define cfi_personality(enc, exp) .cfi_personality enc, exp
  62. # define cfi_lsda(enc, exp) .cfi_lsda enc, exp
  63. # else
  64. # define cfi_sections(sect...)
  65. # define cfi_startproc
  66. # define cfi_endproc
  67. # define cfi_def_cfa(reg, off)
  68. # define cfi_def_cfa_register(reg)
  69. # define cfi_def_cfa_offset(off)
  70. # define cfi_adjust_cfa_offset(off)
  71. # define cfi_offset(reg, off)
  72. # define cfi_rel_offset(reg, off)
  73. # define cfi_register(r1, r2)
  74. # define cfi_return_column(reg)
  75. # define cfi_restore(reg)
  76. # define cfi_same_value(reg)
  77. # define cfi_undefined(reg)
  78. # define cfi_remember_state
  79. # define cfi_restore_state
  80. # define cfi_window_save
  81. # define cfi_personality(enc, exp)
  82. # define cfi_lsda(enc, exp)
  83. # endif
  84. #else /* ! ASSEMBLER */
  85. # ifdef HAVE_ASM_CFI_DIRECTIVES
  86. # define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name)
  87. # define CFI_STRINGIFY2(Name) #Name
  88. # define CFI_SECTIONS(sect...) \
  89. ".cfi_sections " CFI_STRINGIFY(sect)
  90. # define CFI_STARTPROC ".cfi_startproc"
  91. # define CFI_ENDPROC ".cfi_endproc"
  92. # define CFI_DEF_CFA(reg, off) \
  93. ".cfi_def_cfa " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
  94. # define CFI_DEF_CFA_REGISTER(reg) \
  95. ".cfi_def_cfa_register " CFI_STRINGIFY(reg)
  96. # define CFI_DEF_CFA_OFFSET(off) \
  97. ".cfi_def_cfa_offset " CFI_STRINGIFY(off)
  98. # define CFI_ADJUST_CFA_OFFSET(off) \
  99. ".cfi_adjust_cfa_offset " CFI_STRINGIFY(off)
  100. # define CFI_OFFSET(reg, off) \
  101. ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
  102. # define CFI_REL_OFFSET(reg, off) \
  103. ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off)
  104. # define CFI_REGISTER(r1, r2) \
  105. ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2)
  106. # define CFI_RETURN_COLUMN(reg) \
  107. ".cfi_return_column " CFI_STRINGIFY(reg)
  108. # define CFI_RESTORE(reg) \
  109. ".cfi_restore " CFI_STRINGIFY(reg)
  110. # define CFI_UNDEFINED(reg) \
  111. ".cfi_undefined " CFI_STRINGIFY(reg)
  112. # define CFI_REMEMBER_STATE \
  113. ".cfi_remember_state"
  114. # define CFI_RESTORE_STATE \
  115. ".cfi_restore_state"
  116. # define CFI_WINDOW_SAVE \
  117. ".cfi_window_save"
  118. # define CFI_PERSONALITY(enc, exp) \
  119. ".cfi_personality " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
  120. # define CFI_LSDA(enc, exp) \
  121. ".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp)
  122. # else
  123. # define CFI_SECTIONS(sect...)
  124. # define CFI_STARTPROC
  125. # define CFI_ENDPROC
  126. # define CFI_DEF_CFA(reg, off)
  127. # define CFI_DEF_CFA_REGISTER(reg)
  128. # define CFI_DEF_CFA_OFFSET(off)
  129. # define CFI_ADJUST_CFA_OFFSET(off)
  130. # define CFI_OFFSET(reg, off)
  131. # define CFI_REL_OFFSET(reg, off)
  132. # define CFI_REGISTER(r1, r2)
  133. # define CFI_RETURN_COLUMN(reg)
  134. # define CFI_RESTORE(reg)
  135. # define CFI_UNDEFINED(reg)
  136. # define CFI_REMEMBER_STATE
  137. # define CFI_RESTORE_STATE
  138. # define CFI_WINDOW_SAVE
  139. # define CFI_PERSONALITY(enc, exp)
  140. # define CFI_LSDA(enc, exp)
  141. # endif
  142. #endif /* __ASSEMBLER__ */
  143. /* Values used for encoding parameter of cfi_personality and cfi_lsda. */
  144. #define DW_EH_PE_absptr 0x00
  145. #define DW_EH_PE_omit 0xff
  146. #define DW_EH_PE_uleb128 0x01
  147. #define DW_EH_PE_udata2 0x02
  148. #define DW_EH_PE_udata4 0x03
  149. #define DW_EH_PE_udata8 0x04
  150. #define DW_EH_PE_sleb128 0x09
  151. #define DW_EH_PE_sdata2 0x0a
  152. #define DW_EH_PE_sdata4 0x0b
  153. #define DW_EH_PE_sdata8 0x0c
  154. #define DW_EH_PE_signed 0x08
  155. #define DW_EH_PE_pcrel 0x10
  156. #define DW_EH_PE_textrel 0x20
  157. #define DW_EH_PE_datarel 0x30
  158. #define DW_EH_PE_funcrel 0x40
  159. #define DW_EH_PE_aligned 0x50
  160. #define DW_EH_PE_indirect 0x80