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