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 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <http://www.gnu.org/licenses/>. */ 18 19 #include <sys/syscall.h> 20 21 #ifndef C_LABEL 22 23 /* Define a macro we can use to construct the asm name for a C symbol. */ 24 #ifndef __UCLIBC_UNDERSCORES__ 25 #ifdef __STDC__ 26 #define C_LABEL(name) name##: 27 #else 28 #define C_LABEL(name) name/**/: 29 #endif 30 #else 31 #ifdef __STDC__ 32 #define C_LABEL(name) _##name##: 33 #else 34 #define C_LABEL(name) _/**/name/**/: 35 #endif 36 #endif 37 38 #endif 39 40 #ifdef __ASSEMBLER__ 41 /* Mark the end of function named SYM. This is used on some platforms 42 to generate correct debugging information. */ 43 #ifndef END 44 #define END(sym) 45 #endif 46 47 #ifndef JUMPTARGET 48 #define JUMPTARGET(sym) sym 49 #endif 50 51 #define ret_ERRVAL ret 52 53 /* Macros to generate eh_frame unwind information. */ 54 # ifdef HAVE_ASM_CFI_DIRECTIVES 55 # define cfi_sections(sect...) .cfi_sections sect 56 # define cfi_startproc .cfi_startproc 57 # define cfi_endproc .cfi_endproc 58 # define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off 59 # define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg 60 # define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off 61 # define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off 62 # define cfi_offset(reg, off) .cfi_offset reg, off 63 # define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off 64 # define cfi_register(r1, r2) .cfi_register r1, r2 65 # define cfi_return_column(reg) .cfi_return_column reg 66 # define cfi_restore(reg) .cfi_restore reg 67 # define cfi_same_value(reg) .cfi_same_value reg 68 # define cfi_undefined(reg) .cfi_undefined reg 69 # define cfi_remember_state .cfi_remember_state 70 # define cfi_restore_state .cfi_restore_state 71 # define cfi_window_save .cfi_window_save 72 # define cfi_personality(enc, exp) .cfi_personality enc, exp 73 # define cfi_lsda(enc, exp) .cfi_lsda enc, exp 74 75 # else 76 # define cfi_sections(sect...) 77 # define cfi_startproc 78 # define cfi_endproc 79 # define cfi_def_cfa(reg, off) 80 # define cfi_def_cfa_register(reg) 81 # define cfi_def_cfa_offset(off) 82 # define cfi_adjust_cfa_offset(off) 83 # define cfi_offset(reg, off) 84 # define cfi_rel_offset(reg, off) 85 # define cfi_register(r1, r2) 86 # define cfi_return_column(reg) 87 # define cfi_restore(reg) 88 # define cfi_same_value(reg) 89 # define cfi_undefined(reg) 90 # define cfi_remember_state 91 # define cfi_restore_state 92 # define cfi_window_save 93 # define cfi_personality(enc, exp) 94 # define cfi_lsda(enc, exp) 95 # endif 96 97 #else /* ! ASSEMBLER */ 98 # ifdef HAVE_ASM_CFI_DIRECTIVES 99 # define CFI_STRINGIFY(Name) CFI_STRINGIFY2 (Name) 100 # define CFI_STRINGIFY2(Name) #Name 101 # define CFI_SECTIONS(sect...) \ 102 ".cfi_sections " CFI_STRINGIFY(sect) 103 # define CFI_STARTPROC ".cfi_startproc" 104 # define CFI_ENDPROC ".cfi_endproc" 105 # define CFI_DEF_CFA(reg, off) \ 106 ".cfi_def_cfa " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off) 107 # define CFI_DEF_CFA_REGISTER(reg) \ 108 ".cfi_def_cfa_register " CFI_STRINGIFY(reg) 109 # define CFI_DEF_CFA_OFFSET(off) \ 110 ".cfi_def_cfa_offset " CFI_STRINGIFY(off) 111 # define CFI_ADJUST_CFA_OFFSET(off) \ 112 ".cfi_adjust_cfa_offset " CFI_STRINGIFY(off) 113 # define CFI_OFFSET(reg, off) \ 114 ".cfi_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off) 115 # define CFI_REL_OFFSET(reg, off) \ 116 ".cfi_rel_offset " CFI_STRINGIFY(reg) "," CFI_STRINGIFY(off) 117 # define CFI_REGISTER(r1, r2) \ 118 ".cfi_register " CFI_STRINGIFY(r1) "," CFI_STRINGIFY(r2) 119 # define CFI_RETURN_COLUMN(reg) \ 120 ".cfi_return_column " CFI_STRINGIFY(reg) 121 # define CFI_RESTORE(reg) \ 122 ".cfi_restore " CFI_STRINGIFY(reg) 123 # define CFI_UNDEFINED(reg) \ 124 ".cfi_undefined " CFI_STRINGIFY(reg) 125 # define CFI_REMEMBER_STATE \ 126 ".cfi_remember_state" 127 # define CFI_RESTORE_STATE \ 128 ".cfi_restore_state" 129 # define CFI_WINDOW_SAVE \ 130 ".cfi_window_save" 131 # define CFI_PERSONALITY(enc, exp) \ 132 ".cfi_personality " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp) 133 # define CFI_LSDA(enc, exp) \ 134 ".cfi_lsda " CFI_STRINGIFY(enc) "," CFI_STRINGIFY(exp) 135 # else 136 # define CFI_SECTIONS(sect...) 137 # define CFI_STARTPROC 138 # define CFI_ENDPROC 139 # define CFI_DEF_CFA(reg, off) 140 # define CFI_DEF_CFA_REGISTER(reg) 141 # define CFI_DEF_CFA_OFFSET(off) 142 # define CFI_ADJUST_CFA_OFFSET(off) 143 # define CFI_OFFSET(reg, off) 144 # define CFI_REL_OFFSET(reg, off) 145 # define CFI_REGISTER(r1, r2) 146 # define CFI_RETURN_COLUMN(reg) 147 # define CFI_RESTORE(reg) 148 # define CFI_UNDEFINED(reg) 149 # define CFI_REMEMBER_STATE 150 # define CFI_RESTORE_STATE 151 # define CFI_WINDOW_SAVE 152 # define CFI_PERSONALITY(enc, exp) 153 # define CFI_LSDA(enc, exp) 154 # endif 155 156 #endif /* __ASSEMBLER__ */ 157 158 /* Values used for encoding parameter of cfi_personality and cfi_lsda. */ 159 #define DW_EH_PE_absptr 0x00 160 #define DW_EH_PE_omit 0xff 161 #define DW_EH_PE_uleb128 0x01 162 #define DW_EH_PE_udata2 0x02 163 #define DW_EH_PE_udata4 0x03 164 #define DW_EH_PE_udata8 0x04 165 #define DW_EH_PE_sleb128 0x09 166 #define DW_EH_PE_sdata2 0x0a 167 #define DW_EH_PE_sdata4 0x0b 168 #define DW_EH_PE_sdata8 0x0c 169 #define DW_EH_PE_signed 0x08 170 #define DW_EH_PE_pcrel 0x10 171 #define DW_EH_PE_textrel 0x20 172 #define DW_EH_PE_datarel 0x30 173 #define DW_EH_PE_funcrel 0x40 174 #define DW_EH_PE_aligned 0x50 175 #define DW_EH_PE_indirect 0x80 176 177