| 1 | //===------ SystemZDisassembler.cpp - Disassembler for PowerPC ------*- C++ -*-===//cxx . . $ `<file>/arch/SystemZ/SystemZDisassembler.c`/ |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | /* Capstone Disassembly Engine */ |
| 11 | /* By Nguyen Anh Quynh <[email protected]>, 2013-2015 */ |
| 12 | |
| 13 | #ifdef CAPSTONE_HAS_SYSZcxx . . $ `<built-in>:419:9`! |
| 14 | |
| 15 | #include <stdio.h> // DEBUG |
| 16 | #include <stdlib.h> |
| 17 | #include <string.h> |
| 18 | |
| 19 | #include "../../cs_priv.h"cxx . . $ `<file>/cs_priv.h`/ |
| 20 | #include "../../utils.h"cxx . . $ `<file>/utils.h`/ |
| 21 | |
| 22 | #include "SystemZDisassembler.h"cxx . . $ `<file>/arch/SystemZ/SystemZDisassembler.h`/ |
| 23 | |
| 24 | #include "../../MCInst.h"cxx . . $ `<file>/MCInst.h`/ |
| 25 | #include "../../MCInstrDesc.h"cxx . . $ `<file>/MCInstrDesc.h`/ |
| 26 | #include "../../MCFixedLenDisassembler.h"cxx . . $ `<file>/MCFixedLenDisassembler.h`/ |
| 27 | #include "../../MCRegisterInfo.h"cxx . . $ `<file>/MCRegisterInfo.h`/ |
| 28 | #include "../../MCDisassembler.h"cxx . . $ `<file>/MCDisassembler.h`/ |
| 29 | #include "../../MathExtras.h"cxx . . $ `<file>/MathExtras.h`/ |
| 30 | |
| 31 | #include "SystemZMCTargetDesc.h"cxx . . $ `<file>/arch/SystemZ/SystemZMCTargetDesc.h`/ |
| 32 | |
| 33 | static uint64_tcxx . . $ uint64_t# getFeatureBitscxx . . $ getFeatureBits(c104ebd7d68b2193).(int mode) |
| 34 | { |
| 35 | // support everything |
| 36 | return (uint64_tcxx . . $ uint64_t#)-1; |
| 37 | } |
| 38 | |
| 39 | static DecodeStatuscxx . . $ DecodeStatus# decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, const unsigned *Regs) |
| 40 | { |
| 41 | //assert(RegNo < 16 && "Invalid register"); |
| 42 | RegNo = Regs[RegNo]; |
| 43 | if (RegNo == 0) |
| 44 | return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.; |
| 45 | |
| 46 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, (unsigned)RegNo); |
| 47 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 48 | } |
| 49 | |
| 50 | static DecodeStatuscxx . . $ DecodeStatus# DecodeGR32BitRegisterClasscxx . . $ DecodeGR32BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 51 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 52 | { |
| 53 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_GR32Regscxx . . $ SystemZMC_GR32Regs.); |
| 54 | } |
| 55 | |
| 56 | static DecodeStatuscxx . . $ DecodeStatus# DecodeGRH32BitRegisterClasscxx . . $ DecodeGRH32BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 57 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 58 | { |
| 59 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_GRH32Regscxx . . $ SystemZMC_GRH32Regs.); |
| 60 | } |
| 61 | |
| 62 | static DecodeStatuscxx . . $ DecodeStatus# DecodeGR64BitRegisterClasscxx . . $ DecodeGR64BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 63 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 64 | { |
| 65 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 66 | } |
| 67 | |
| 68 | static DecodeStatuscxx . . $ DecodeStatus# DecodeGR128BitRegisterClasscxx . . $ DecodeGR128BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 69 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 70 | { |
| 71 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_GR128Regscxx . . $ SystemZMC_GR128Regs.); |
| 72 | } |
| 73 | |
| 74 | static DecodeStatuscxx . . $ DecodeStatus# DecodeADDR64BitRegisterClasscxx . . $ DecodeADDR64BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 75 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 76 | { |
| 77 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 78 | } |
| 79 | |
| 80 | static DecodeStatuscxx . . $ DecodeStatus# DecodeFP32BitRegisterClasscxx . . $ DecodeFP32BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 81 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 82 | { |
| 83 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_FP32Regscxx . . $ SystemZMC_FP32Regs.); |
| 84 | } |
| 85 | |
| 86 | static DecodeStatuscxx . . $ DecodeStatus# DecodeFP64BitRegisterClasscxx . . $ DecodeFP64BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 87 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 88 | { |
| 89 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_FP64Regscxx . . $ SystemZMC_FP64Regs.); |
| 90 | } |
| 91 | |
| 92 | static DecodeStatuscxx . . $ DecodeStatus# DecodeFP128BitRegisterClasscxx . . $ DecodeFP128BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 93 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 94 | { |
| 95 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_FP128Regscxx . . $ SystemZMC_FP128Regs.); |
| 96 | } |
| 97 | |
| 98 | static DecodeStatuscxx . . $ DecodeStatus# DecodeVR32BitRegisterClasscxx . . $ DecodeVR32BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 99 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 100 | { |
| 101 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_VR32Regscxx . . $ SystemZMC_VR32Regs.); |
| 102 | } |
| 103 | |
| 104 | static DecodeStatuscxx . . $ DecodeStatus# DecodeVR64BitRegisterClasscxx . . $ DecodeVR64BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 105 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 106 | { |
| 107 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_VR64Regscxx . . $ SystemZMC_VR64Regs.); |
| 108 | } |
| 109 | |
| 110 | static DecodeStatuscxx . . $ DecodeStatus# DecodeVR128BitRegisterClasscxx . . $ DecodeVR128BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 111 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 112 | { |
| 113 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_VR128Regscxx . . $ SystemZMC_VR128Regs.); |
| 114 | } |
| 115 | |
| 116 | static DecodeStatuscxx . . $ DecodeStatus# DecodeAR32BitRegisterClasscxx . . $ DecodeAR32BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 117 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 118 | { |
| 119 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_AR32Regscxx . . $ SystemZMC_AR32Regs.); |
| 120 | } |
| 121 | |
| 122 | static DecodeStatuscxx . . $ DecodeStatus# DecodeCR64BitRegisterClasscxx . . $ DecodeCR64BitRegisterClass(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# RegNo, |
| 123 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 124 | { |
| 125 | return decodeRegisterClasscxx . . $ decodeRegisterClass(51023acc4cb9bbbe).(Inst, RegNo, SystemZMC_CR64Regscxx . . $ SystemZMC_CR64Regs.); |
| 126 | } |
| 127 | |
| 128 | static DecodeStatuscxx . . $ DecodeStatus# decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm) |
| 129 | { |
| 130 | //assert(isUInt<N>(Imm) && "Invalid immediate"); |
| 131 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Imm); |
| 132 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 133 | } |
| 134 | |
| 135 | static DecodeStatuscxx . . $ DecodeStatus# decodeSImmOperandcxx . . $ decodeSImmOperand(7e59be3029d5251b).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, unsigned N) |
| 136 | { |
| 137 | //assert(isUInt<N>(Imm) && "Invalid immediate"); |
| 138 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(Imm, N)); |
| 139 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 140 | } |
| 141 | |
| 142 | static DecodeStatuscxx . . $ DecodeStatus# decodeU1ImmOperandcxx . . $ decodeU1ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 143 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 144 | { |
| 145 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 146 | } |
| 147 | |
| 148 | static DecodeStatuscxx . . $ DecodeStatus# decodeU2ImmOperandcxx . . $ decodeU2ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 149 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 150 | { |
| 151 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 152 | } |
| 153 | |
| 154 | static DecodeStatuscxx . . $ DecodeStatus# decodeU3ImmOperandcxx . . $ decodeU3ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 155 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 156 | { |
| 157 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 158 | } |
| 159 | |
| 160 | static DecodeStatuscxx . . $ DecodeStatus# decodeU4ImmOperandcxx . . $ decodeU4ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 161 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 162 | { |
| 163 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 164 | } |
| 165 | |
| 166 | static DecodeStatuscxx . . $ DecodeStatus# decodeU6ImmOperandcxx . . $ decodeU6ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 167 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 168 | { |
| 169 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 170 | } |
| 171 | |
| 172 | static DecodeStatuscxx . . $ DecodeStatus# decodeU8ImmOperandcxx . . $ decodeU8ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 173 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 174 | { |
| 175 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 176 | } |
| 177 | |
| 178 | static DecodeStatuscxx . . $ DecodeStatus# decodeU12ImmOperandcxx . . $ decodeU12ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 179 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 180 | { |
| 181 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 182 | } |
| 183 | |
| 184 | static DecodeStatuscxx . . $ DecodeStatus# decodeU16ImmOperandcxx . . $ decodeU16ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 185 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 186 | { |
| 187 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 188 | } |
| 189 | |
| 190 | static DecodeStatuscxx . . $ DecodeStatus# decodeU32ImmOperandcxx . . $ decodeU32ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 191 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 192 | { |
| 193 | return decodeUImmOperandcxx . . $ decodeUImmOperand(238af85f72da3423).(Inst, Imm); |
| 194 | } |
| 195 | |
| 196 | static DecodeStatuscxx . . $ DecodeStatus# decodeS8ImmOperandcxx . . $ decodeS8ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 197 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 198 | { |
| 199 | return decodeSImmOperandcxx . . $ decodeSImmOperand(7e59be3029d5251b).(Inst, Imm, 8); |
| 200 | } |
| 201 | |
| 202 | static DecodeStatuscxx . . $ DecodeStatus# decodeS16ImmOperandcxx . . $ decodeS16ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 203 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 204 | { |
| 205 | return decodeSImmOperandcxx . . $ decodeSImmOperand(7e59be3029d5251b).(Inst, Imm, 16); |
| 206 | } |
| 207 | |
| 208 | static DecodeStatuscxx . . $ DecodeStatus# decodeS32ImmOperandcxx . . $ decodeS32ImmOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 209 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 210 | { |
| 211 | return decodeSImmOperandcxx . . $ decodeSImmOperand(7e59be3029d5251b).(Inst, Imm, 32); |
| 212 | } |
| 213 | |
| 214 | static DecodeStatuscxx . . $ DecodeStatus# decodePCDBLOperandcxx . . $ decodePCDBLOperand(8fc2385d3fa73e12).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 215 | uint64_tcxx . . $ uint64_t# Address, unsigned N) |
| 216 | { |
| 217 | //assert(isUInt<N>(Imm) && "Invalid PC-relative offset"); |
| 218 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(Imm, N) * 2 + Address); |
| 219 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 220 | } |
| 221 | |
| 222 | static DecodeStatuscxx . . $ DecodeStatus# decodePC12DBLBranchOperandcxx . . $ decodePC12DBLBranchOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 223 | uint64_tcxx . . $ uint64_t# Address, |
| 224 | const void *Decoder) |
| 225 | { |
| 226 | return decodePCDBLOperandcxx . . $ decodePCDBLOperand(8fc2385d3fa73e12).(Inst, Imm, Address, 12); |
| 227 | } |
| 228 | |
| 229 | static DecodeStatuscxx . . $ DecodeStatus# decodePC16DBLBranchOperandcxx . . $ decodePC16DBLBranchOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 230 | uint64_tcxx . . $ uint64_t# Address, |
| 231 | const void *Decoder) |
| 232 | { |
| 233 | return decodePCDBLOperandcxx . . $ decodePCDBLOperand(8fc2385d3fa73e12).(Inst, Imm, Address, 16); |
| 234 | } |
| 235 | |
| 236 | static DecodeStatuscxx . . $ DecodeStatus# decodePC24DBLBranchOperandcxx . . $ decodePC24DBLBranchOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 237 | uint64_tcxx . . $ uint64_t# Address, |
| 238 | const void *Decoder) |
| 239 | { |
| 240 | return decodePCDBLOperandcxx . . $ decodePCDBLOperand(8fc2385d3fa73e12).(Inst, Imm, Address, 24); |
| 241 | } |
| 242 | |
| 243 | static DecodeStatuscxx . . $ DecodeStatus# decodePC32DBLBranchOperandcxx . . $ decodePC32DBLBranchOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 244 | uint64_tcxx . . $ uint64_t# Address, |
| 245 | const void *Decoder) |
| 246 | { |
| 247 | return decodePCDBLOperandcxx . . $ decodePCDBLOperand(8fc2385d3fa73e12).(Inst, Imm, Address, 32); |
| 248 | } |
| 249 | |
| 250 | static DecodeStatuscxx . . $ DecodeStatus# decodePC32DBLOperandcxx . . $ decodePC32DBLOperand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Imm, |
| 251 | uint64_tcxx . . $ uint64_t# Address, |
| 252 | const void *Decoder) |
| 253 | { |
| 254 | return decodePCDBLOperandcxx . . $ decodePCDBLOperand(8fc2385d3fa73e12).(Inst, Imm, Address, 32); |
| 255 | } |
| 256 | |
| 257 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDAddr12Operandcxx . . $ decodeBDAddr12Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 258 | const unsigned *Regs) |
| 259 | { |
| 260 | uint64_tcxx . . $ uint64_t# Base = Field >> 12; |
| 261 | uint64_tcxx . . $ uint64_t# Disp = Field & 0xfff; |
| 262 | //assert(Base < 16 && "Invalid BDAddr12"); |
| 263 | |
| 264 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 265 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Disp); |
| 266 | |
| 267 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 268 | } |
| 269 | |
| 270 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDAddr20Operandcxx . . $ decodeBDAddr20Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 271 | const unsigned *Regs) |
| 272 | { |
| 273 | uint64_tcxx . . $ uint64_t# Base = Field >> 20; |
| 274 | uint64_tcxx . . $ uint64_t# Disp = ((Field << 12) & 0xff000) | ((Field >> 8) & 0xfff); |
| 275 | //assert(Base < 16 && "Invalid BDAddr20"); |
| 276 | |
| 277 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 278 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(Disp, 20)); |
| 279 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 280 | } |
| 281 | |
| 282 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDXAddr12Operandcxx . . $ decodeBDXAddr12Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 283 | const unsigned *Regs) |
| 284 | { |
| 285 | uint64_tcxx . . $ uint64_t# Index = Field >> 16; |
| 286 | uint64_tcxx . . $ uint64_t# Base = (Field >> 12) & 0xf; |
| 287 | uint64_tcxx . . $ uint64_t# Disp = Field & 0xfff; |
| 288 | |
| 289 | //assert(Index < 16 && "Invalid BDXAddr12"); |
| 290 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 291 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Disp); |
| 292 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Index == 0 ? 0 : Regs[Index]); |
| 293 | |
| 294 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 295 | } |
| 296 | |
| 297 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDXAddr20Operandcxx . . $ decodeBDXAddr20Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 298 | const unsigned *Regs) |
| 299 | { |
| 300 | uint64_tcxx . . $ uint64_t# Index = Field >> 24; |
| 301 | uint64_tcxx . . $ uint64_t# Base = (Field >> 20) & 0xf; |
| 302 | uint64_tcxx . . $ uint64_t# Disp = ((Field & 0xfff00) >> 8) | ((Field & 0xff) << 12); |
| 303 | |
| 304 | //assert(Index < 16 && "Invalid BDXAddr20"); |
| 305 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 306 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, SignExtend64cxx . . $ SignExtend64(2a41822c65b512db).(Disp, 20)); |
| 307 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Index == 0 ? 0 : Regs[Index]); |
| 308 | |
| 309 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 310 | } |
| 311 | |
| 312 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDLAddr12Len8Operandcxx . . $ decodeBDLAddr12Len8Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 313 | const unsigned *Regs) |
| 314 | { |
| 315 | uint64_tcxx . . $ uint64_t# Length = Field >> 16; |
| 316 | uint64_tcxx . . $ uint64_t# Base = (Field >> 12) & 0xf; |
| 317 | uint64_tcxx . . $ uint64_t# Disp = Field & 0xfff; |
| 318 | //assert(Length < 256 && "Invalid BDLAddr12Len8"); |
| 319 | |
| 320 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 321 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Disp); |
| 322 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Length + 1); |
| 323 | |
| 324 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 325 | } |
| 326 | |
| 327 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDRAddr12Operandcxx . . $ decodeBDRAddr12Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 328 | const unsigned *Regs) |
| 329 | { |
| 330 | uint64_tcxx . . $ uint64_t# Length = Field >> 16; |
| 331 | uint64_tcxx . . $ uint64_t# Base = (Field >> 12) & 0xf; |
| 332 | uint64_tcxx . . $ uint64_t# Disp = Field & 0xfff; |
| 333 | //assert(Length < 16 && "Invalid BDRAddr12"); |
| 334 | |
| 335 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 336 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Disp); |
| 337 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Regs[Length]); |
| 338 | |
| 339 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 340 | } |
| 341 | |
| 342 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDVAddr12Operandcxx . . $ decodeBDVAddr12Operand(51023acc4cb9bbbe).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 343 | const unsigned *Regs) |
| 344 | { |
| 345 | uint64_tcxx . . $ uint64_t# Index = Field >> 16; |
| 346 | uint64_tcxx . . $ uint64_t# Base = (Field >> 12) & 0xf; |
| 347 | uint64_tcxx . . $ uint64_t# Disp = Field & 0xfff; |
| 348 | //assert(Index < 32 && "Invalid BDVAddr12"); |
| 349 | |
| 350 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Base == 0 ? 0 : Regs[Base]); |
| 351 | MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(Inst, Disp); |
| 352 | MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, SystemZMC_VR128Regscxx . . $ SystemZMC_VR128Regs.[Index]); |
| 353 | |
| 354 | return MCDisassembler_Successcxx . . $ MCDisassembler_Success.; |
| 355 | } |
| 356 | |
| 357 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDAddr32Disp12Operandcxx . . $ decodeBDAddr32Disp12Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 358 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 359 | { |
| 360 | return decodeBDAddr12Operandcxx . . $ decodeBDAddr12Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR32Regscxx . . $ SystemZMC_GR32Regs.); |
| 361 | } |
| 362 | |
| 363 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDAddr32Disp20Operandcxx . . $ decodeBDAddr32Disp20Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 364 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 365 | { |
| 366 | return decodeBDAddr20Operandcxx . . $ decodeBDAddr20Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR32Regscxx . . $ SystemZMC_GR32Regs.); |
| 367 | } |
| 368 | |
| 369 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDAddr64Disp12Operandcxx . . $ decodeBDAddr64Disp12Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 370 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 371 | { |
| 372 | return decodeBDAddr12Operandcxx . . $ decodeBDAddr12Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 373 | } |
| 374 | |
| 375 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDAddr64Disp20Operandcxx . . $ decodeBDAddr64Disp20Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 376 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 377 | { |
| 378 | return decodeBDAddr20Operandcxx . . $ decodeBDAddr20Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 379 | } |
| 380 | |
| 381 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDXAddr64Disp12Operandcxx . . $ decodeBDXAddr64Disp12Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 382 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 383 | { |
| 384 | return decodeBDXAddr12Operandcxx . . $ decodeBDXAddr12Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 385 | } |
| 386 | |
| 387 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDXAddr64Disp20Operandcxx . . $ decodeBDXAddr64Disp20Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 388 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 389 | { |
| 390 | return decodeBDXAddr20Operandcxx . . $ decodeBDXAddr20Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 391 | } |
| 392 | |
| 393 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDLAddr64Disp12Len4Operandcxx . . $ decodeBDLAddr64Disp12Len4Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 394 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 395 | { |
| 396 | return decodeBDLAddr12Len8Operandcxx . . $ decodeBDLAddr12Len8Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 397 | } |
| 398 | |
| 399 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDLAddr64Disp12Len8Operandcxx . . $ decodeBDLAddr64Disp12Len8Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 400 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 401 | { |
| 402 | return decodeBDLAddr12Len8Operandcxx . . $ decodeBDLAddr12Len8Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 403 | } |
| 404 | |
| 405 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDRAddr64Disp12Operandcxx . . $ decodeBDRAddr64Disp12Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 406 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 407 | { |
| 408 | return decodeBDRAddr12Operandcxx . . $ decodeBDRAddr12Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 409 | } |
| 410 | |
| 411 | static DecodeStatuscxx . . $ DecodeStatus# decodeBDVAddr64Disp12Operandcxx . . $ decodeBDVAddr64Disp12Operand(9e81003452fc9bbc).(MCInstcxx . . $ MCInst# *Inst, uint64_tcxx . . $ uint64_t# Field, |
| 412 | uint64_tcxx . . $ uint64_t# Address, const void *Decoder) |
| 413 | { |
| 414 | return decodeBDVAddr12Operandcxx . . $ decodeBDVAddr12Operand(51023acc4cb9bbbe).(Inst, Field, SystemZMC_GR64Regscxx . . $ SystemZMC_GR64Regs.); |
| 415 | } |
| 416 | |
| 417 | |
| 418 | #define GET_SUBTARGETINFO_ENUMcxx . . $ `arch/SystemZ/SystemZDisassembler.c:418:9`! |
| 419 | #include "SystemZGenSubtargetInfo.inc"cxx . . $ `<file>/arch/SystemZ/SystemZGenSubtargetInfo.inc`/ |
| 420 | #include "SystemZGenDisassemblerTables.inc"cxx . . $ `<file>/arch/SystemZ/SystemZGenDisassemblerTables.inc`/ |
| 421 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! SystemZ_getInstructioncxx . . $ SystemZ_getInstruction(fe94ce91eeab61e9).(cshcxx . . $ csh# ud, const uint8_tcxx . . $ uint8_t# *code, size_t code_len, MCInstcxx . . $ MCInst# *MI, |
| 422 | uint16_tcxx . . $ uint16_t# *size, uint64_tcxx . . $ uint64_t# address, void *info) |
| 423 | { |
| 424 | uint64_tcxx . . $ uint64_t# Inst; |
| 425 | const uint8_tcxx . . $ uint8_t# *Table; |
| 426 | uint16_tcxx . . $ uint16_t# I; |
| 427 | |
| 428 | // The top 2 bits of the first byte specify the size. |
| 429 | if (*code < 0x40) { |
| 430 | *size = 2; |
| 431 | Table = DecoderTable16cxx . . $ DecoderTable16.; |
| 432 | } else if (*code < 0xc0) { |
| 433 | *size = 4; |
| 434 | Table = DecoderTable32cxx . . $ DecoderTable32.; |
| 435 | } else { |
| 436 | *size = 6; |
| 437 | Table = DecoderTable48cxx . . $ DecoderTable48.; |
| 438 | } |
| 439 | |
| 440 | if (code_len < *size) |
| 441 | // short of input data |
| 442 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 443 | |
| 444 | if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) { |
| 445 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail., 0, offsetofcxx . . $ `<external>/16391990256953433862/stddef.h:431:9`!(cs_detail, sysz)+sizeof(cs_syszcxx . . $ cs_sysz#)); |
| 446 | } |
| 447 | |
| 448 | // Construct the instruction. |
| 449 | Inst = 0; |
| 450 | for (I = 0; I < *size; ++I) |
| 451 | Inst = (Inst << 8) | code[I]; |
| 452 | |
| 453 | return decodeInstructioncxx . . $ decodeInstruction(bc479c73c8356a46).(Table, MI, Inst, address, info, 0); |
| 454 | } |
| 455 | |
| 456 | #define GET_REGINFO_ENUMcxx . . $ `arch/SystemZ/SystemZDisassembler.c:456:9`! |
| 457 | #define GET_REGINFO_MC_DESCcxx . . $ `arch/SystemZ/SystemZDisassembler.c:457:9`! |
| 458 | #include "SystemZGenRegisterInfo.inc"cxx . . $ `<file>/arch/SystemZ/SystemZGenRegisterInfo.inc`/ |
| 459 | void SystemZ_initcxx . . $ SystemZ_init(c2e0c34190506c3d).(MCRegisterInfocxx . . $ MCRegisterInfo# *MRI) |
| 460 | { |
| 461 | /* |
| 462 | InitMCRegisterInfo(SystemZRegDesc, 98, RA, PC, |
| 463 | SystemZMCRegisterClasses, 12, |
| 464 | SystemZRegUnitRoots, |
| 465 | 49, |
| 466 | SystemZRegDiffLists, |
| 467 | SystemZRegStrings, |
| 468 | SystemZSubRegIdxLists, |
| 469 | 7, |
| 470 | SystemZSubRegIdxRanges, |
| 471 | SystemZRegEncodingTable); |
| 472 | */ |
| 473 | |
| 474 | MCRegisterInfo_InitMCRegisterInfocxx . . $ MCRegisterInfo_InitMCRegisterInfo(5e86a0227010d6ff).(MRI, SystemZRegDesccxx . . $ SystemZRegDesc., 194, |
| 475 | 0, 0, |
| 476 | SystemZMCRegisterClassescxx . . $ SystemZMCRegisterClasses., 21, |
| 477 | 0, 0, |
| 478 | SystemZRegDiffListscxx . . $ SystemZRegDiffLists., |
| 479 | 0, |
| 480 | SystemZSubRegIdxListscxx . . $ SystemZSubRegIdxLists., 7, |
| 481 | 0); |
| 482 | } |
| 483 | |
| 484 | #endif |