| 1 | /* Capstone Disassembly Engine */cxx . . $ `<file>/arch/ARM/ARMMapping.c`/ |
| 2 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2019 */ |
| 3 | |
| 4 | #ifdef CAPSTONE_HAS_ARMcxx . . $ `<built-in>:412:9`! |
| 5 | |
| 6 | #include <stdio.h> // debug |
| 7 | #include <string.h> |
| 8 | |
| 9 | #include "../../cs_priv.h"cxx . . $ `<file>/cs_priv.h`/ |
| 10 | |
| 11 | #include "ARMMapping.h"cxx . . $ `<file>/arch/ARM/ARMMapping.h`/ |
| 12 | |
| 13 | #define GET_INSTRINFO_ENUMcxx . . $ `arch/ARM/ARMMapping.c:13:9`! |
| 14 | #include "ARMGenInstrInfo.inc"cxx . . $ `<file>/arch/ARM/ARMGenInstrInfo.inc`/ |
| 15 | |
| 16 | #ifndef CAPSTONE_DIET |
| 17 | static const name_mapcxx . . $ name_map# reg_name_mapscxx . . $ reg_name_maps.[] = { |
| 18 | { ARM_REG_INVALIDcxx . . $ ARM_REG_INVALID., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! }, |
| 19 | { ARM_REG_APSRcxx . . $ ARM_REG_APSR., "apsr"}, |
| 20 | { ARM_REG_APSR_NZCVcxx . . $ ARM_REG_APSR_NZCV., "apsr_nzcv"}, |
| 21 | { ARM_REG_CPSRcxx . . $ ARM_REG_CPSR., "cpsr"}, |
| 22 | { ARM_REG_FPEXCcxx . . $ ARM_REG_FPEXC., "fpexc"}, |
| 23 | { ARM_REG_FPINSTcxx . . $ ARM_REG_FPINST., "fpinst"}, |
| 24 | { ARM_REG_FPSCRcxx . . $ ARM_REG_FPSCR., "fpscr"}, |
| 25 | { ARM_REG_FPSCR_NZCVcxx . . $ ARM_REG_FPSCR_NZCV., "fpscr_nzcv"}, |
| 26 | { ARM_REG_FPSIDcxx . . $ ARM_REG_FPSID., "fpsid"}, |
| 27 | { ARM_REG_ITSTATEcxx . . $ ARM_REG_ITSTATE., "itstate"}, |
| 28 | { ARM_REG_LRcxx . . $ ARM_REG_LR., "lr"}, |
| 29 | { ARM_REG_PCcxx . . $ ARM_REG_PC., "pc"}, |
| 30 | { ARM_REG_SPcxx . . $ ARM_REG_SP., "sp"}, |
| 31 | { ARM_REG_SPSRcxx . . $ ARM_REG_SPSR., "spsr"}, |
| 32 | { ARM_REG_D0cxx . . $ ARM_REG_D0., "d0"}, |
| 33 | { ARM_REG_D1cxx . . $ ARM_REG_D1., "d1"}, |
| 34 | { ARM_REG_D2cxx . . $ ARM_REG_D2., "d2"}, |
| 35 | { ARM_REG_D3cxx . . $ ARM_REG_D3., "d3"}, |
| 36 | { ARM_REG_D4cxx . . $ ARM_REG_D4., "d4"}, |
| 37 | { ARM_REG_D5cxx . . $ ARM_REG_D5., "d5"}, |
| 38 | { ARM_REG_D6cxx . . $ ARM_REG_D6., "d6"}, |
| 39 | { ARM_REG_D7cxx . . $ ARM_REG_D7., "d7"}, |
| 40 | { ARM_REG_D8cxx . . $ ARM_REG_D8., "d8"}, |
| 41 | { ARM_REG_D9cxx . . $ ARM_REG_D9., "d9"}, |
| 42 | { ARM_REG_D10cxx . . $ ARM_REG_D10., "d10"}, |
| 43 | { ARM_REG_D11cxx . . $ ARM_REG_D11., "d11"}, |
| 44 | { ARM_REG_D12cxx . . $ ARM_REG_D12., "d12"}, |
| 45 | { ARM_REG_D13cxx . . $ ARM_REG_D13., "d13"}, |
| 46 | { ARM_REG_D14cxx . . $ ARM_REG_D14., "d14"}, |
| 47 | { ARM_REG_D15cxx . . $ ARM_REG_D15., "d15"}, |
| 48 | { ARM_REG_D16cxx . . $ ARM_REG_D16., "d16"}, |
| 49 | { ARM_REG_D17cxx . . $ ARM_REG_D17., "d17"}, |
| 50 | { ARM_REG_D18cxx . . $ ARM_REG_D18., "d18"}, |
| 51 | { ARM_REG_D19cxx . . $ ARM_REG_D19., "d19"}, |
| 52 | { ARM_REG_D20cxx . . $ ARM_REG_D20., "d20"}, |
| 53 | { ARM_REG_D21cxx . . $ ARM_REG_D21., "d21"}, |
| 54 | { ARM_REG_D22cxx . . $ ARM_REG_D22., "d22"}, |
| 55 | { ARM_REG_D23cxx . . $ ARM_REG_D23., "d23"}, |
| 56 | { ARM_REG_D24cxx . . $ ARM_REG_D24., "d24"}, |
| 57 | { ARM_REG_D25cxx . . $ ARM_REG_D25., "d25"}, |
| 58 | { ARM_REG_D26cxx . . $ ARM_REG_D26., "d26"}, |
| 59 | { ARM_REG_D27cxx . . $ ARM_REG_D27., "d27"}, |
| 60 | { ARM_REG_D28cxx . . $ ARM_REG_D28., "d28"}, |
| 61 | { ARM_REG_D29cxx . . $ ARM_REG_D29., "d29"}, |
| 62 | { ARM_REG_D30cxx . . $ ARM_REG_D30., "d30"}, |
| 63 | { ARM_REG_D31cxx . . $ ARM_REG_D31., "d31"}, |
| 64 | { ARM_REG_FPINST2cxx . . $ ARM_REG_FPINST2., "fpinst2"}, |
| 65 | { ARM_REG_MVFR0cxx . . $ ARM_REG_MVFR0., "mvfr0"}, |
| 66 | { ARM_REG_MVFR1cxx . . $ ARM_REG_MVFR1., "mvfr1"}, |
| 67 | { ARM_REG_MVFR2cxx . . $ ARM_REG_MVFR2., "mvfr2"}, |
| 68 | { ARM_REG_Q0cxx . . $ ARM_REG_Q0., "q0"}, |
| 69 | { ARM_REG_Q1cxx . . $ ARM_REG_Q1., "q1"}, |
| 70 | { ARM_REG_Q2cxx . . $ ARM_REG_Q2., "q2"}, |
| 71 | { ARM_REG_Q3cxx . . $ ARM_REG_Q3., "q3"}, |
| 72 | { ARM_REG_Q4cxx . . $ ARM_REG_Q4., "q4"}, |
| 73 | { ARM_REG_Q5cxx . . $ ARM_REG_Q5., "q5"}, |
| 74 | { ARM_REG_Q6cxx . . $ ARM_REG_Q6., "q6"}, |
| 75 | { ARM_REG_Q7cxx . . $ ARM_REG_Q7., "q7"}, |
| 76 | { ARM_REG_Q8cxx . . $ ARM_REG_Q8., "q8"}, |
| 77 | { ARM_REG_Q9cxx . . $ ARM_REG_Q9., "q9"}, |
| 78 | { ARM_REG_Q10cxx . . $ ARM_REG_Q10., "q10"}, |
| 79 | { ARM_REG_Q11cxx . . $ ARM_REG_Q11., "q11"}, |
| 80 | { ARM_REG_Q12cxx . . $ ARM_REG_Q12., "q12"}, |
| 81 | { ARM_REG_Q13cxx . . $ ARM_REG_Q13., "q13"}, |
| 82 | { ARM_REG_Q14cxx . . $ ARM_REG_Q14., "q14"}, |
| 83 | { ARM_REG_Q15cxx . . $ ARM_REG_Q15., "q15"}, |
| 84 | { ARM_REG_R0cxx . . $ ARM_REG_R0., "r0"}, |
| 85 | { ARM_REG_R1cxx . . $ ARM_REG_R1., "r1"}, |
| 86 | { ARM_REG_R2cxx . . $ ARM_REG_R2., "r2"}, |
| 87 | { ARM_REG_R3cxx . . $ ARM_REG_R3., "r3"}, |
| 88 | { ARM_REG_R4cxx . . $ ARM_REG_R4., "r4"}, |
| 89 | { ARM_REG_R5cxx . . $ ARM_REG_R5., "r5"}, |
| 90 | { ARM_REG_R6cxx . . $ ARM_REG_R6., "r6"}, |
| 91 | { ARM_REG_R7cxx . . $ ARM_REG_R7., "r7"}, |
| 92 | { ARM_REG_R8cxx . . $ ARM_REG_R8., "r8"}, |
| 93 | { ARM_REG_R9cxx . . $ ARM_REG_R9., "sb"}, |
| 94 | { ARM_REG_R10cxx . . $ ARM_REG_R10., "sl"}, |
| 95 | { ARM_REG_R11cxx . . $ ARM_REG_R11., "fp"}, |
| 96 | { ARM_REG_R12cxx . . $ ARM_REG_R12., "ip"}, |
| 97 | { ARM_REG_S0cxx . . $ ARM_REG_S0., "s0"}, |
| 98 | { ARM_REG_S1cxx . . $ ARM_REG_S1., "s1"}, |
| 99 | { ARM_REG_S2cxx . . $ ARM_REG_S2., "s2"}, |
| 100 | { ARM_REG_S3cxx . . $ ARM_REG_S3., "s3"}, |
| 101 | { ARM_REG_S4cxx . . $ ARM_REG_S4., "s4"}, |
| 102 | { ARM_REG_S5cxx . . $ ARM_REG_S5., "s5"}, |
| 103 | { ARM_REG_S6cxx . . $ ARM_REG_S6., "s6"}, |
| 104 | { ARM_REG_S7cxx . . $ ARM_REG_S7., "s7"}, |
| 105 | { ARM_REG_S8cxx . . $ ARM_REG_S8., "s8"}, |
| 106 | { ARM_REG_S9cxx . . $ ARM_REG_S9., "s9"}, |
| 107 | { ARM_REG_S10cxx . . $ ARM_REG_S10., "s10"}, |
| 108 | { ARM_REG_S11cxx . . $ ARM_REG_S11., "s11"}, |
| 109 | { ARM_REG_S12cxx . . $ ARM_REG_S12., "s12"}, |
| 110 | { ARM_REG_S13cxx . . $ ARM_REG_S13., "s13"}, |
| 111 | { ARM_REG_S14cxx . . $ ARM_REG_S14., "s14"}, |
| 112 | { ARM_REG_S15cxx . . $ ARM_REG_S15., "s15"}, |
| 113 | { ARM_REG_S16cxx . . $ ARM_REG_S16., "s16"}, |
| 114 | { ARM_REG_S17cxx . . $ ARM_REG_S17., "s17"}, |
| 115 | { ARM_REG_S18cxx . . $ ARM_REG_S18., "s18"}, |
| 116 | { ARM_REG_S19cxx . . $ ARM_REG_S19., "s19"}, |
| 117 | { ARM_REG_S20cxx . . $ ARM_REG_S20., "s20"}, |
| 118 | { ARM_REG_S21cxx . . $ ARM_REG_S21., "s21"}, |
| 119 | { ARM_REG_S22cxx . . $ ARM_REG_S22., "s22"}, |
| 120 | { ARM_REG_S23cxx . . $ ARM_REG_S23., "s23"}, |
| 121 | { ARM_REG_S24cxx . . $ ARM_REG_S24., "s24"}, |
| 122 | { ARM_REG_S25cxx . . $ ARM_REG_S25., "s25"}, |
| 123 | { ARM_REG_S26cxx . . $ ARM_REG_S26., "s26"}, |
| 124 | { ARM_REG_S27cxx . . $ ARM_REG_S27., "s27"}, |
| 125 | { ARM_REG_S28cxx . . $ ARM_REG_S28., "s28"}, |
| 126 | { ARM_REG_S29cxx . . $ ARM_REG_S29., "s29"}, |
| 127 | { ARM_REG_S30cxx . . $ ARM_REG_S30., "s30"}, |
| 128 | { ARM_REG_S31cxx . . $ ARM_REG_S31., "s31"}, |
| 129 | }; |
| 130 | static const name_mapcxx . . $ name_map# reg_name_maps2cxx . . $ reg_name_maps2.[] = { |
| 131 | { ARM_REG_INVALIDcxx . . $ ARM_REG_INVALID., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! }, |
| 132 | { ARM_REG_APSRcxx . . $ ARM_REG_APSR., "apsr"}, |
| 133 | { ARM_REG_APSR_NZCVcxx . . $ ARM_REG_APSR_NZCV., "apsr_nzcv"}, |
| 134 | { ARM_REG_CPSRcxx . . $ ARM_REG_CPSR., "cpsr"}, |
| 135 | { ARM_REG_FPEXCcxx . . $ ARM_REG_FPEXC., "fpexc"}, |
| 136 | { ARM_REG_FPINSTcxx . . $ ARM_REG_FPINST., "fpinst"}, |
| 137 | { ARM_REG_FPSCRcxx . . $ ARM_REG_FPSCR., "fpscr"}, |
| 138 | { ARM_REG_FPSCR_NZCVcxx . . $ ARM_REG_FPSCR_NZCV., "fpscr_nzcv"}, |
| 139 | { ARM_REG_FPSIDcxx . . $ ARM_REG_FPSID., "fpsid"}, |
| 140 | { ARM_REG_ITSTATEcxx . . $ ARM_REG_ITSTATE., "itstate"}, |
| 141 | { ARM_REG_LRcxx . . $ ARM_REG_LR., "lr"}, |
| 142 | { ARM_REG_PCcxx . . $ ARM_REG_PC., "pc"}, |
| 143 | { ARM_REG_SPcxx . . $ ARM_REG_SP., "sp"}, |
| 144 | { ARM_REG_SPSRcxx . . $ ARM_REG_SPSR., "spsr"}, |
| 145 | { ARM_REG_D0cxx . . $ ARM_REG_D0., "d0"}, |
| 146 | { ARM_REG_D1cxx . . $ ARM_REG_D1., "d1"}, |
| 147 | { ARM_REG_D2cxx . . $ ARM_REG_D2., "d2"}, |
| 148 | { ARM_REG_D3cxx . . $ ARM_REG_D3., "d3"}, |
| 149 | { ARM_REG_D4cxx . . $ ARM_REG_D4., "d4"}, |
| 150 | { ARM_REG_D5cxx . . $ ARM_REG_D5., "d5"}, |
| 151 | { ARM_REG_D6cxx . . $ ARM_REG_D6., "d6"}, |
| 152 | { ARM_REG_D7cxx . . $ ARM_REG_D7., "d7"}, |
| 153 | { ARM_REG_D8cxx . . $ ARM_REG_D8., "d8"}, |
| 154 | { ARM_REG_D9cxx . . $ ARM_REG_D9., "d9"}, |
| 155 | { ARM_REG_D10cxx . . $ ARM_REG_D10., "d10"}, |
| 156 | { ARM_REG_D11cxx . . $ ARM_REG_D11., "d11"}, |
| 157 | { ARM_REG_D12cxx . . $ ARM_REG_D12., "d12"}, |
| 158 | { ARM_REG_D13cxx . . $ ARM_REG_D13., "d13"}, |
| 159 | { ARM_REG_D14cxx . . $ ARM_REG_D14., "d14"}, |
| 160 | { ARM_REG_D15cxx . . $ ARM_REG_D15., "d15"}, |
| 161 | { ARM_REG_D16cxx . . $ ARM_REG_D16., "d16"}, |
| 162 | { ARM_REG_D17cxx . . $ ARM_REG_D17., "d17"}, |
| 163 | { ARM_REG_D18cxx . . $ ARM_REG_D18., "d18"}, |
| 164 | { ARM_REG_D19cxx . . $ ARM_REG_D19., "d19"}, |
| 165 | { ARM_REG_D20cxx . . $ ARM_REG_D20., "d20"}, |
| 166 | { ARM_REG_D21cxx . . $ ARM_REG_D21., "d21"}, |
| 167 | { ARM_REG_D22cxx . . $ ARM_REG_D22., "d22"}, |
| 168 | { ARM_REG_D23cxx . . $ ARM_REG_D23., "d23"}, |
| 169 | { ARM_REG_D24cxx . . $ ARM_REG_D24., "d24"}, |
| 170 | { ARM_REG_D25cxx . . $ ARM_REG_D25., "d25"}, |
| 171 | { ARM_REG_D26cxx . . $ ARM_REG_D26., "d26"}, |
| 172 | { ARM_REG_D27cxx . . $ ARM_REG_D27., "d27"}, |
| 173 | { ARM_REG_D28cxx . . $ ARM_REG_D28., "d28"}, |
| 174 | { ARM_REG_D29cxx . . $ ARM_REG_D29., "d29"}, |
| 175 | { ARM_REG_D30cxx . . $ ARM_REG_D30., "d30"}, |
| 176 | { ARM_REG_D31cxx . . $ ARM_REG_D31., "d31"}, |
| 177 | { ARM_REG_FPINST2cxx . . $ ARM_REG_FPINST2., "fpinst2"}, |
| 178 | { ARM_REG_MVFR0cxx . . $ ARM_REG_MVFR0., "mvfr0"}, |
| 179 | { ARM_REG_MVFR1cxx . . $ ARM_REG_MVFR1., "mvfr1"}, |
| 180 | { ARM_REG_MVFR2cxx . . $ ARM_REG_MVFR2., "mvfr2"}, |
| 181 | { ARM_REG_Q0cxx . . $ ARM_REG_Q0., "q0"}, |
| 182 | { ARM_REG_Q1cxx . . $ ARM_REG_Q1., "q1"}, |
| 183 | { ARM_REG_Q2cxx . . $ ARM_REG_Q2., "q2"}, |
| 184 | { ARM_REG_Q3cxx . . $ ARM_REG_Q3., "q3"}, |
| 185 | { ARM_REG_Q4cxx . . $ ARM_REG_Q4., "q4"}, |
| 186 | { ARM_REG_Q5cxx . . $ ARM_REG_Q5., "q5"}, |
| 187 | { ARM_REG_Q6cxx . . $ ARM_REG_Q6., "q6"}, |
| 188 | { ARM_REG_Q7cxx . . $ ARM_REG_Q7., "q7"}, |
| 189 | { ARM_REG_Q8cxx . . $ ARM_REG_Q8., "q8"}, |
| 190 | { ARM_REG_Q9cxx . . $ ARM_REG_Q9., "q9"}, |
| 191 | { ARM_REG_Q10cxx . . $ ARM_REG_Q10., "q10"}, |
| 192 | { ARM_REG_Q11cxx . . $ ARM_REG_Q11., "q11"}, |
| 193 | { ARM_REG_Q12cxx . . $ ARM_REG_Q12., "q12"}, |
| 194 | { ARM_REG_Q13cxx . . $ ARM_REG_Q13., "q13"}, |
| 195 | { ARM_REG_Q14cxx . . $ ARM_REG_Q14., "q14"}, |
| 196 | { ARM_REG_Q15cxx . . $ ARM_REG_Q15., "q15"}, |
| 197 | { ARM_REG_R0cxx . . $ ARM_REG_R0., "r0"}, |
| 198 | { ARM_REG_R1cxx . . $ ARM_REG_R1., "r1"}, |
| 199 | { ARM_REG_R2cxx . . $ ARM_REG_R2., "r2"}, |
| 200 | { ARM_REG_R3cxx . . $ ARM_REG_R3., "r3"}, |
| 201 | { ARM_REG_R4cxx . . $ ARM_REG_R4., "r4"}, |
| 202 | { ARM_REG_R5cxx . . $ ARM_REG_R5., "r5"}, |
| 203 | { ARM_REG_R6cxx . . $ ARM_REG_R6., "r6"}, |
| 204 | { ARM_REG_R7cxx . . $ ARM_REG_R7., "r7"}, |
| 205 | { ARM_REG_R8cxx . . $ ARM_REG_R8., "r8"}, |
| 206 | { ARM_REG_R9cxx . . $ ARM_REG_R9., "r9"}, |
| 207 | { ARM_REG_R10cxx . . $ ARM_REG_R10., "r10"}, |
| 208 | { ARM_REG_R11cxx . . $ ARM_REG_R11., "r11"}, |
| 209 | { ARM_REG_R12cxx . . $ ARM_REG_R12., "r12"}, |
| 210 | { ARM_REG_S0cxx . . $ ARM_REG_S0., "s0"}, |
| 211 | { ARM_REG_S1cxx . . $ ARM_REG_S1., "s1"}, |
| 212 | { ARM_REG_S2cxx . . $ ARM_REG_S2., "s2"}, |
| 213 | { ARM_REG_S3cxx . . $ ARM_REG_S3., "s3"}, |
| 214 | { ARM_REG_S4cxx . . $ ARM_REG_S4., "s4"}, |
| 215 | { ARM_REG_S5cxx . . $ ARM_REG_S5., "s5"}, |
| 216 | { ARM_REG_S6cxx . . $ ARM_REG_S6., "s6"}, |
| 217 | { ARM_REG_S7cxx . . $ ARM_REG_S7., "s7"}, |
| 218 | { ARM_REG_S8cxx . . $ ARM_REG_S8., "s8"}, |
| 219 | { ARM_REG_S9cxx . . $ ARM_REG_S9., "s9"}, |
| 220 | { ARM_REG_S10cxx . . $ ARM_REG_S10., "s10"}, |
| 221 | { ARM_REG_S11cxx . . $ ARM_REG_S11., "s11"}, |
| 222 | { ARM_REG_S12cxx . . $ ARM_REG_S12., "s12"}, |
| 223 | { ARM_REG_S13cxx . . $ ARM_REG_S13., "s13"}, |
| 224 | { ARM_REG_S14cxx . . $ ARM_REG_S14., "s14"}, |
| 225 | { ARM_REG_S15cxx . . $ ARM_REG_S15., "s15"}, |
| 226 | { ARM_REG_S16cxx . . $ ARM_REG_S16., "s16"}, |
| 227 | { ARM_REG_S17cxx . . $ ARM_REG_S17., "s17"}, |
| 228 | { ARM_REG_S18cxx . . $ ARM_REG_S18., "s18"}, |
| 229 | { ARM_REG_S19cxx . . $ ARM_REG_S19., "s19"}, |
| 230 | { ARM_REG_S20cxx . . $ ARM_REG_S20., "s20"}, |
| 231 | { ARM_REG_S21cxx . . $ ARM_REG_S21., "s21"}, |
| 232 | { ARM_REG_S22cxx . . $ ARM_REG_S22., "s22"}, |
| 233 | { ARM_REG_S23cxx . . $ ARM_REG_S23., "s23"}, |
| 234 | { ARM_REG_S24cxx . . $ ARM_REG_S24., "s24"}, |
| 235 | { ARM_REG_S25cxx . . $ ARM_REG_S25., "s25"}, |
| 236 | { ARM_REG_S26cxx . . $ ARM_REG_S26., "s26"}, |
| 237 | { ARM_REG_S27cxx . . $ ARM_REG_S27., "s27"}, |
| 238 | { ARM_REG_S28cxx . . $ ARM_REG_S28., "s28"}, |
| 239 | { ARM_REG_S29cxx . . $ ARM_REG_S29., "s29"}, |
| 240 | { ARM_REG_S30cxx . . $ ARM_REG_S30., "s30"}, |
| 241 | { ARM_REG_S31cxx . . $ ARM_REG_S31., "s31"}, |
| 242 | }; |
| 243 | #endif |
| 244 | |
| 245 | const char *ARM_reg_namecxx . . $ ARM_reg_name(efd1348d9ae5172e).(cshcxx . . $ csh# handle, unsigned int reg) |
| 246 | { |
| 247 | #ifndef CAPSTONE_DIET |
| 248 | if (reg >= ARR_SIZEcxx . . $ `utils.h:24:9`!(reg_name_maps)) |
| 249 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 250 | |
| 251 | return reg_name_mapscxx . . $ reg_name_maps.[reg].namecxx . . $ name_map#name.; |
| 252 | #else |
| 253 | return NULL; |
| 254 | #endif |
| 255 | } |
| 256 | |
| 257 | const char *ARM_reg_name2cxx . . $ ARM_reg_name2(efd1348d9ae5172e).(cshcxx . . $ csh# handle, unsigned int reg) |
| 258 | { |
| 259 | #ifndef CAPSTONE_DIET |
| 260 | if (reg >= ARR_SIZEcxx . . $ `utils.h:24:9`!(reg_name_maps2)) |
| 261 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 262 | |
| 263 | return reg_name_maps2cxx . . $ reg_name_maps2.[reg].namecxx . . $ name_map#name.; |
| 264 | #else |
| 265 | return NULL; |
| 266 | #endif |
| 267 | } |
| 268 | |
| 269 | static const insn_mapcxx . . $ insn_map# insnscxx . . $ insns.[] = { |
| 270 | // dummy item |
| 271 | { |
| 272 | 0, 0, |
| 273 | #ifndef CAPSTONE_DIET |
| 274 | { 0 }, { 0 }, { 0 }, 0, 0 |
| 275 | #endif |
| 276 | }, |
| 277 | #include "ARMMappingInsn.inc"cxx . . $ `<file>/arch/ARM/ARMMappingInsn.inc`/ |
| 278 | }; |
| 279 | |
| 280 | // look for @id in @insns |
| 281 | // return -1 if not found |
| 282 | static unsigned int find_insncxx . . $ find_insn(2141b656ce2cc063).(unsigned int id) |
| 283 | { |
| 284 | // binary searching since the IDs are sorted in order |
| 285 | unsigned int left, right, m; |
| 286 | unsigned int max = ARR_SIZEcxx . . $ `utils.h:24:9`!(insns); |
| 287 | |
| 288 | right = max - 1; |
| 289 | |
| 290 | if (id < insnscxx . . $ insns.[0].idcxx . . $ insn_map#id. || id > insnscxx . . $ insns.[right].idcxx . . $ insn_map#id.) |
| 291 | // not found |
| 292 | return -1; |
| 293 | |
| 294 | left = 0; |
| 295 | |
| 296 | while(left <= right) { |
| 297 | m = (left + right) / 2; |
| 298 | if (id == insnscxx . . $ insns.[m].idcxx . . $ insn_map#id.) { |
| 299 | return m; |
| 300 | } |
| 301 | |
| 302 | if (id < insnscxx . . $ insns.[m].idcxx . . $ insn_map#id.) |
| 303 | right = m - 1; |
| 304 | else |
| 305 | left = m + 1; |
| 306 | } |
| 307 | |
| 308 | // not found |
| 309 | // printf("NOT FOUNDDDDDDDDDDDDDDD id = %u\n", id); |
| 310 | return -1; |
| 311 | } |
| 312 | |
| 313 | void ARM_get_insn_idcxx . . $ ARM_get_insn_id(b32a94ba649bfb5a).(cs_structcxx . . $ cs_struct# *h, cs_insncxx . . $ cs_insn# *insn, unsigned int id) |
| 314 | { |
| 315 | unsigned int i = find_insncxx . . $ find_insn(2141b656ce2cc063).(id); |
| 316 | if (i != -1) { |
| 317 | insn->idcxx . . $ cs_insn#id. = insnscxx . . $ insns.[i].mapidcxx . . $ insn_map#mapid.; |
| 318 | |
| 319 | // printf("id = %u, mapid = %u\n", id, insn->id); |
| 320 | |
| 321 | if (h->detailcxx . . $ cs_struct#detail.) { |
| 322 | #ifndef CAPSTONE_DIET |
| 323 | cs_structcxx . . $ cs_struct# handle; |
| 324 | handle.detailcxx . . $ cs_struct#detail. = h->detailcxx . . $ cs_struct#detail.; |
| 325 | |
| 326 | memcpycxx . . $ memcpy(cc817cb175f282d).(insn->detailcxx . . $ cs_insn#detail.->regs_readcxx . . $ cs_detail#regs_read., insnscxx . . $ insns.[i].regs_usecxx . . $ insn_map#regs_use., sizeof(insnscxx . . $ insns.[i].regs_usecxx . . $ insn_map#regs_use.)); |
| 327 | insn->detailcxx . . $ cs_insn#detail.->regs_read_countcxx . . $ cs_detail#regs_read_count. = (uint8_tcxx . . $ uint8_t#)count_positivecxx . . $ count_positive(ad0aaa07bfcd0593).(insnscxx . . $ insns.[i].regs_usecxx . . $ insn_map#regs_use.); |
| 328 | |
| 329 | memcpycxx . . $ memcpy(cc817cb175f282d).(insn->detailcxx . . $ cs_insn#detail.->regs_writecxx . . $ cs_detail#regs_write., insnscxx . . $ insns.[i].regs_modcxx . . $ insn_map#regs_mod., sizeof(insnscxx . . $ insns.[i].regs_modcxx . . $ insn_map#regs_mod.)); |
| 330 | insn->detailcxx . . $ cs_insn#detail.->regs_write_countcxx . . $ cs_detail#regs_write_count. = (uint8_tcxx . . $ uint8_t#)count_positivecxx . . $ count_positive(ad0aaa07bfcd0593).(insnscxx . . $ insns.[i].regs_modcxx . . $ insn_map#regs_mod.); |
| 331 | |
| 332 | memcpycxx . . $ memcpy(cc817cb175f282d).(insn->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups., insnscxx . . $ insns.[i].groupscxx . . $ insn_map#groups., sizeof(insnscxx . . $ insns.[i].groupscxx . . $ insn_map#groups.)); |
| 333 | insn->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count. = (uint8_tcxx . . $ uint8_t#)count_positive8cxx . . $ count_positive8(ca1608e2c87725e2).(insnscxx . . $ insns.[i].groupscxx . . $ insn_map#groups.); |
| 334 | |
| 335 | insn->detailcxx . . $ cs_insn#detail.->armcxx . . $ cs_detail#$anonymous_type_0#arm..update_flagscxx . . $ cs_arm#update_flags. = cs_reg_writecxx . . $ cs_reg_write(66cc6fe29eef7753).((cshcxx . . $ csh#)&handle, insn, ARM_REG_CPSRcxx . . $ ARM_REG_CPSR.); |
| 336 | |
| 337 | if (insnscxx . . $ insns.[i].branchcxx . . $ insn_map#branch. || insnscxx . . $ insns.[i].indirect_branchcxx . . $ insn_map#indirect_branch.) { |
| 338 | // this insn also belongs to JUMP group. add JUMP group |
| 339 | insn->detailcxx . . $ cs_insn#detail.->groupscxx . . $ cs_detail#groups.[insn->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.] = ARM_GRP_JUMPcxx . . $ ARM_GRP_JUMP.; |
| 340 | insn->detailcxx . . $ cs_insn#detail.->groups_countcxx . . $ cs_detail#groups_count.++; |
| 341 | } |
| 342 | #endif |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | #ifndef CAPSTONE_DIET |
| 348 | static const char * const insn_name_mapscxx . . $ insn_name_maps.[] = { |
| 349 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, // ARM_INS_INVALID |
| 350 | #include "ARMMappingInsnName.inc"cxx . . $ `<file>/arch/ARM/ARMMappingInsnName.inc`/ |
| 351 | }; |
| 352 | #endif |
| 353 | |
| 354 | const char *ARM_insn_namecxx . . $ ARM_insn_name(efd1348d9ae5172e).(cshcxx . . $ csh# handle, unsigned int id) |
| 355 | { |
| 356 | #ifndef CAPSTONE_DIET |
| 357 | if (id >= ARM_INS_ENDINGcxx . . $ ARM_INS_ENDING.) |
| 358 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 359 | |
| 360 | return insn_name_mapscxx . . $ insn_name_maps.[id]; |
| 361 | #else |
| 362 | return NULL; |
| 363 | #endif |
| 364 | } |
| 365 | |
| 366 | #ifndef CAPSTONE_DIET |
| 367 | static const name_mapcxx . . $ name_map# group_name_mapscxx . . $ group_name_maps.[] = { |
| 368 | // generic groups |
| 369 | { ARM_GRP_INVALIDcxx . . $ ARM_GRP_INVALID., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`! }, |
| 370 | { ARM_GRP_JUMPcxx . . $ ARM_GRP_JUMP., "jump" }, |
| 371 | { ARM_GRP_CALLcxx . . $ ARM_GRP_CALL., "call" }, |
| 372 | { ARM_GRP_INTcxx . . $ ARM_GRP_INT., "int" }, |
| 373 | { ARM_GRP_PRIVILEGEcxx . . $ ARM_GRP_PRIVILEGE., "privilege" }, |
| 374 | { ARM_GRP_BRANCH_RELATIVEcxx . . $ ARM_GRP_BRANCH_RELATIVE., "branch_relative" }, |
| 375 | |
| 376 | // architecture-specific groups |
| 377 | { ARM_GRP_CRYPTOcxx . . $ ARM_GRP_CRYPTO., "crypto" }, |
| 378 | { ARM_GRP_DATABARRIERcxx . . $ ARM_GRP_DATABARRIER., "databarrier" }, |
| 379 | { ARM_GRP_DIVIDEcxx . . $ ARM_GRP_DIVIDE., "divide" }, |
| 380 | { ARM_GRP_FPARMV8cxx . . $ ARM_GRP_FPARMV8., "fparmv8" }, |
| 381 | { ARM_GRP_MULTPROcxx . . $ ARM_GRP_MULTPRO., "multpro" }, |
| 382 | { ARM_GRP_NEONcxx . . $ ARM_GRP_NEON., "neon" }, |
| 383 | { ARM_GRP_T2EXTRACTPACKcxx . . $ ARM_GRP_T2EXTRACTPACK., "T2EXTRACTPACK" }, |
| 384 | { ARM_GRP_THUMB2DSPcxx . . $ ARM_GRP_THUMB2DSP., "THUMB2DSP" }, |
| 385 | { ARM_GRP_TRUSTZONEcxx . . $ ARM_GRP_TRUSTZONE., "TRUSTZONE" }, |
| 386 | { ARM_GRP_V4Tcxx . . $ ARM_GRP_V4T., "v4t" }, |
| 387 | { ARM_GRP_V5Tcxx . . $ ARM_GRP_V5T., "v5t" }, |
| 388 | { ARM_GRP_V5TEcxx . . $ ARM_GRP_V5TE., "v5te" }, |
| 389 | { ARM_GRP_V6cxx . . $ ARM_GRP_V6., "v6" }, |
| 390 | { ARM_GRP_V6T2cxx . . $ ARM_GRP_V6T2., "v6t2" }, |
| 391 | { ARM_GRP_V7cxx . . $ ARM_GRP_V7., "v7" }, |
| 392 | { ARM_GRP_V8cxx . . $ ARM_GRP_V8., "v8" }, |
| 393 | { ARM_GRP_VFP2cxx . . $ ARM_GRP_VFP2., "vfp2" }, |
| 394 | { ARM_GRP_VFP3cxx . . $ ARM_GRP_VFP3., "vfp3" }, |
| 395 | { ARM_GRP_VFP4cxx . . $ ARM_GRP_VFP4., "vfp4" }, |
| 396 | { ARM_GRP_ARMcxx . . $ ARM_GRP_ARM., "arm" }, |
| 397 | { ARM_GRP_MCLASScxx . . $ ARM_GRP_MCLASS., "mclass" }, |
| 398 | { ARM_GRP_NOTMCLASScxx . . $ ARM_GRP_NOTMCLASS., "notmclass" }, |
| 399 | { ARM_GRP_THUMBcxx . . $ ARM_GRP_THUMB., "thumb" }, |
| 400 | { ARM_GRP_THUMB1ONLYcxx . . $ ARM_GRP_THUMB1ONLY., "thumb1only" }, |
| 401 | { ARM_GRP_THUMB2cxx . . $ ARM_GRP_THUMB2., "thumb2" }, |
| 402 | { ARM_GRP_PREV8cxx . . $ ARM_GRP_PREV8., "prev8" }, |
| 403 | { ARM_GRP_FPVMLXcxx . . $ ARM_GRP_FPVMLX., "fpvmlx" }, |
| 404 | { ARM_GRP_MULOPScxx . . $ ARM_GRP_MULOPS., "mulops" }, |
| 405 | { ARM_GRP_CRCcxx . . $ ARM_GRP_CRC., "crc" }, |
| 406 | { ARM_GRP_DPVFPcxx . . $ ARM_GRP_DPVFP., "dpvfp" }, |
| 407 | { ARM_GRP_V6Mcxx . . $ ARM_GRP_V6M., "v6m" }, |
| 408 | { ARM_GRP_VIRTUALIZATIONcxx . . $ ARM_GRP_VIRTUALIZATION., "virtualization" }, |
| 409 | }; |
| 410 | #endif |
| 411 | |
| 412 | const char *ARM_group_namecxx . . $ ARM_group_name(efd1348d9ae5172e).(cshcxx . . $ csh# handle, unsigned int id) |
| 413 | { |
| 414 | #ifndef CAPSTONE_DIET |
| 415 | return id2namecxx . . $ id2name(92d4aec78e87b576).(group_name_mapscxx . . $ group_name_maps., ARR_SIZEcxx . . $ `utils.h:24:9`!(group_name_maps), id); |
| 416 | #else |
| 417 | return NULL; |
| 418 | #endif |
| 419 | } |
| 420 | |
| 421 | // list all relative branch instructions |
| 422 | // ie: insns[i].branch && !insns[i].indirect_branch |
| 423 | static const unsigned int insn_relcxx . . $ insn_rel.[] = { |
| 424 | ARM_BLcxx . . $ ARM_BL., |
| 425 | ARM_BLX_predcxx . . $ ARM_BLX_pred., |
| 426 | ARM_Bcccxx . . $ ARM_Bcc., |
| 427 | ARM_t2Bcxx . . $ ARM_t2B., |
| 428 | ARM_t2Bcccxx . . $ ARM_t2Bcc., |
| 429 | ARM_tBcxx . . $ ARM_tB., |
| 430 | ARM_tBcccxx . . $ ARM_tBcc., |
| 431 | ARM_tCBNZcxx . . $ ARM_tCBNZ., |
| 432 | ARM_tCBZcxx . . $ ARM_tCBZ., |
| 433 | ARM_BL_predcxx . . $ ARM_BL_pred., |
| 434 | ARM_BLXicxx . . $ ARM_BLXi., |
| 435 | ARM_tBLcxx . . $ ARM_tBL., |
| 436 | ARM_tBLXicxx . . $ ARM_tBLXi., |
| 437 | 0 |
| 438 | }; |
| 439 | |
| 440 | static const unsigned int insn_blx_rel_to_armcxx . . $ insn_blx_rel_to_arm.[] = { |
| 441 | ARM_tBLXicxx . . $ ARM_tBLXi., |
| 442 | 0 |
| 443 | }; |
| 444 | |
| 445 | // check if this insn is relative branch |
| 446 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! ARM_rel_branchcxx . . $ ARM_rel_branch(39412e1dc8bf7218).(cs_structcxx . . $ cs_struct# *h, unsigned int id) |
| 447 | { |
| 448 | int i; |
| 449 | |
| 450 | for (i = 0; insn_relcxx . . $ insn_rel.[i]; i++) { |
| 451 | if (id == insn_relcxx . . $ insn_rel.[i]) { |
| 452 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 453 | } |
| 454 | } |
| 455 | |
| 456 | // not found |
| 457 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 458 | } |
| 459 | |
| 460 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! ARM_blx_to_arm_modecxx . . $ ARM_blx_to_arm_mode(39412e1dc8bf7218).(cs_structcxx . . $ cs_struct# *h, unsigned int id) { |
| 461 | int i; |
| 462 | |
| 463 | for (i = 0; insn_blx_rel_to_armcxx . . $ insn_blx_rel_to_arm.[i]; i++) |
| 464 | if (id == insn_blx_rel_to_armcxx . . $ insn_blx_rel_to_arm.[i]) |
| 465 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 466 | |
| 467 | // not found |
| 468 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 469 | |
| 470 | } |
| 471 | |
| 472 | #ifndef CAPSTONE_DIET |
| 473 | // map instruction to its characteristics |
| 474 | typedef struct insn_opcxx . . $ insn_op# { |
| 475 | uint8_tcxx . . $ uint8_t# accesscxx . . $ insn_op#access.[7]; |
| 476 | } insn_opcxx . . $ insn_op#; |
| 477 | |
| 478 | static const insn_opcxx . . $ insn_op# insn_opscxx . . $ insn_ops.[] = { |
| 479 | { |
| 480 | // NULL item |
| 481 | { 0 } |
| 482 | }, |
| 483 | |
| 484 | #include "ARMMappingInsnOp.inc"cxx . . $ `<file>/arch/ARM/ARMMappingInsnOp.inc`/ |
| 485 | }; |
| 486 | |
| 487 | // given internal insn id, return operand access info |
| 488 | const uint8_tcxx . . $ uint8_t# *ARM_get_op_accesscxx . . $ ARM_get_op_access(76a777cf16cd607d).(cs_structcxx . . $ cs_struct# *h, unsigned int id) |
| 489 | { |
| 490 | int i = insn_findcxx . . $ insn_find(1ce6b9640f5aa651).(insnscxx . . $ insns., ARR_SIZEcxx . . $ `utils.h:24:9`!(insns), id, &h->insn_cachecxx . . $ cs_struct#insn_cache.); |
| 491 | if (i != 0) { |
| 492 | return insn_opscxx . . $ insn_ops.[i].accesscxx . . $ insn_op#access.; |
| 493 | } |
| 494 | |
| 495 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 496 | } |
| 497 | |
| 498 | void ARM_reg_accesscxx . . $ ARM_reg_access(a4e53139cd2f126c).(const cs_insncxx . . $ cs_insn# *insn, |
| 499 | cs_regscxx . . $ cs_regs# regs_read, uint8_tcxx . . $ uint8_t# *regs_read_count, |
| 500 | cs_regscxx . . $ cs_regs# regs_write, uint8_tcxx . . $ uint8_t# *regs_write_count) |
| 501 | { |
| 502 | uint8_tcxx . . $ uint8_t# i; |
| 503 | uint8_tcxx . . $ uint8_t# read_count, write_count; |
| 504 | cs_armcxx . . $ cs_arm# *arm = &(insn->detailcxx . . $ cs_insn#detail.->armcxx . . $ cs_detail#$anonymous_type_0#arm.); |
| 505 | |
| 506 | read_count = insn->detailcxx . . $ cs_insn#detail.->regs_read_countcxx . . $ cs_detail#regs_read_count.; |
| 507 | write_count = insn->detailcxx . . $ cs_insn#detail.->regs_write_countcxx . . $ cs_detail#regs_write_count.; |
| 508 | |
| 509 | // implicit registers |
| 510 | memcpycxx . . $ memcpy(cc817cb175f282d).(regs_read, insn->detailcxx . . $ cs_insn#detail.->regs_readcxx . . $ cs_detail#regs_read., read_count * sizeof(insn->detailcxx . . $ cs_insn#detail.->regs_readcxx . . $ cs_detail#regs_read.[0])); |
| 511 | memcpycxx . . $ memcpy(cc817cb175f282d).(regs_write, insn->detailcxx . . $ cs_insn#detail.->regs_writecxx . . $ cs_detail#regs_write., write_count * sizeof(insn->detailcxx . . $ cs_insn#detail.->regs_writecxx . . $ cs_detail#regs_write.[0])); |
| 512 | |
| 513 | // explicit registers |
| 514 | for (i = 0; i < arm->op_countcxx . . $ cs_arm#op_count.; i++) { |
| 515 | cs_arm_opcxx . . $ cs_arm_op# *op = &(arm->operandscxx . . $ cs_arm#operands.[i]); |
| 516 | switch((int)op->typecxx . . $ cs_arm_op#type.) { |
| 517 | case ARM_OP_REGcxx . . $ ARM_OP_REG.: |
| 518 | if ((op->accesscxx . . $ cs_arm_op#access. & CS_AC_READcxx . . $ CS_AC_READ.) && !arr_existcxx . . $ arr_exist(c35293ec828d81e3).(regs_read, read_count, op->regcxx . . $ cs_arm_op#$anonymous_type_1#reg.)) { |
| 519 | regs_read[read_count] = (uint16_tcxx . . $ uint16_t#)op->regcxx . . $ cs_arm_op#$anonymous_type_1#reg.; |
| 520 | read_count++; |
| 521 | } |
| 522 | if ((op->accesscxx . . $ cs_arm_op#access. & CS_AC_WRITEcxx . . $ CS_AC_WRITE.) && !arr_existcxx . . $ arr_exist(c35293ec828d81e3).(regs_write, write_count, op->regcxx . . $ cs_arm_op#$anonymous_type_1#reg.)) { |
| 523 | regs_write[write_count] = (uint16_tcxx . . $ uint16_t#)op->regcxx . . $ cs_arm_op#$anonymous_type_1#reg.; |
| 524 | write_count++; |
| 525 | } |
| 526 | break; |
| 527 | case ARM_OP_MEMcxx . . $ ARM_OP_MEM.: |
| 528 | // registers appeared in memory references always being read |
| 529 | if ((op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..basecxx . . $ arm_op_mem#base. != ARM_REG_INVALIDcxx . . $ ARM_REG_INVALID.) && !arr_existcxx . . $ arr_exist(c35293ec828d81e3).(regs_read, read_count, op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..basecxx . . $ arm_op_mem#base.)) { |
| 530 | regs_read[read_count] = (uint16_tcxx . . $ uint16_t#)op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..basecxx . . $ arm_op_mem#base.; |
| 531 | read_count++; |
| 532 | } |
| 533 | if ((op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..indexcxx . . $ arm_op_mem#index. != ARM_REG_INVALIDcxx . . $ ARM_REG_INVALID.) && !arr_existcxx . . $ arr_exist(c35293ec828d81e3).(regs_read, read_count, op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..indexcxx . . $ arm_op_mem#index.)) { |
| 534 | regs_read[read_count] = (uint16_tcxx . . $ uint16_t#)op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..indexcxx . . $ arm_op_mem#index.; |
| 535 | read_count++; |
| 536 | } |
| 537 | if ((arm->writebackcxx . . $ cs_arm#writeback.) && (op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..basecxx . . $ arm_op_mem#base. != ARM_REG_INVALIDcxx . . $ ARM_REG_INVALID.) && !arr_existcxx . . $ arr_exist(c35293ec828d81e3).(regs_write, write_count, op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..basecxx . . $ arm_op_mem#base.)) { |
| 538 | regs_write[write_count] = (uint16_tcxx . . $ uint16_t#)op->memcxx . . $ cs_arm_op#$anonymous_type_1#mem..basecxx . . $ arm_op_mem#base.; |
| 539 | write_count++; |
| 540 | } |
| 541 | default: |
| 542 | break; |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | *regs_read_count = read_count; |
| 547 | *regs_write_count = write_count; |
| 548 | } |
| 549 | #endif |
| 550 | |
| 551 | #endif |