Debian Codegraph @

arch/Sparc/SparcDisassembler.c

raw symbols SCIP
1 //===------ SparcDisassembler.cpp - Disassembler for PowerPC ------*- C++ -*-===//cxx . . $ `<file>/arch/Sparc/SparcDisassembler.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_SPARCcxx . . $ `<built-in>:418: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 "SparcDisassembler.h"cxx . . $ `<file>/arch/Sparc/SparcDisassembler.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
32 #define GET_REGINFO_MC_DESCcxx . . $ `arch/Sparc/SparcDisassembler.c:32:9`!
33 #define GET_REGINFO_ENUMcxx . . $ `arch/Sparc/SparcDisassembler.c:33:9`!
34 #include "SparcGenRegisterInfo.inc"cxx . . $ `<file>/arch/Sparc/SparcGenRegisterInfo.inc`/
35 static const unsigned IntRegDecoderTablecxx . . $ IntRegDecoderTable.[] = {
36 SP_G0cxx . . $ SP_G0., SP_G1cxx . . $ SP_G1., SP_G2cxx . . $ SP_G2., SP_G3cxx . . $ SP_G3.,
37 SP_G4cxx . . $ SP_G4., SP_G5cxx . . $ SP_G5., SP_G6cxx . . $ SP_G6., SP_G7cxx . . $ SP_G7.,
38 SP_O0cxx . . $ SP_O0., SP_O1cxx . . $ SP_O1., SP_O2cxx . . $ SP_O2., SP_O3cxx . . $ SP_O3.,
39 SP_O4cxx . . $ SP_O4., SP_O5cxx . . $ SP_O5., SP_O6cxx . . $ SP_O6., SP_O7cxx . . $ SP_O7.,
40 SP_L0cxx . . $ SP_L0., SP_L1cxx . . $ SP_L1., SP_L2cxx . . $ SP_L2., SP_L3cxx . . $ SP_L3.,
41 SP_L4cxx . . $ SP_L4., SP_L5cxx . . $ SP_L5., SP_L6cxx . . $ SP_L6., SP_L7cxx . . $ SP_L7.,
42 SP_I0cxx . . $ SP_I0., SP_I1cxx . . $ SP_I1., SP_I2cxx . . $ SP_I2., SP_I3cxx . . $ SP_I3.,
43 SP_I4cxx . . $ SP_I4., SP_I5cxx . . $ SP_I5., SP_I6cxx . . $ SP_I6., SP_I7cxx . . $ SP_I7.
44 };
45
46 static const unsigned FPRegDecoderTablecxx . . $ FPRegDecoderTable.[] = {
47 SP_F0cxx . . $ SP_F0., SP_F1cxx . . $ SP_F1., SP_F2cxx . . $ SP_F2., SP_F3cxx . . $ SP_F3.,
48 SP_F4cxx . . $ SP_F4., SP_F5cxx . . $ SP_F5., SP_F6cxx . . $ SP_F6., SP_F7cxx . . $ SP_F7.,
49 SP_F8cxx . . $ SP_F8., SP_F9cxx . . $ SP_F9., SP_F10cxx . . $ SP_F10., SP_F11cxx . . $ SP_F11.,
50 SP_F12cxx . . $ SP_F12., SP_F13cxx . . $ SP_F13., SP_F14cxx . . $ SP_F14., SP_F15cxx . . $ SP_F15.,
51 SP_F16cxx . . $ SP_F16., SP_F17cxx . . $ SP_F17., SP_F18cxx . . $ SP_F18., SP_F19cxx . . $ SP_F19.,
52 SP_F20cxx . . $ SP_F20., SP_F21cxx . . $ SP_F21., SP_F22cxx . . $ SP_F22., SP_F23cxx . . $ SP_F23.,
53 SP_F24cxx . . $ SP_F24., SP_F25cxx . . $ SP_F25., SP_F26cxx . . $ SP_F26., SP_F27cxx . . $ SP_F27.,
54 SP_F28cxx . . $ SP_F28., SP_F29cxx . . $ SP_F29., SP_F30cxx . . $ SP_F30., SP_F31cxx . . $ SP_F31.
55 };
56
57 static const unsigned DFPRegDecoderTablecxx . . $ DFPRegDecoderTable.[] = {
58 SP_D0cxx . . $ SP_D0., SP_D16cxx . . $ SP_D16., SP_D1cxx . . $ SP_D1., SP_D17cxx . . $ SP_D17.,
59 SP_D2cxx . . $ SP_D2., SP_D18cxx . . $ SP_D18., SP_D3cxx . . $ SP_D3., SP_D19cxx . . $ SP_D19.,
60 SP_D4cxx . . $ SP_D4., SP_D20cxx . . $ SP_D20., SP_D5cxx . . $ SP_D5., SP_D21cxx . . $ SP_D21.,
61 SP_D6cxx . . $ SP_D6., SP_D22cxx . . $ SP_D22., SP_D7cxx . . $ SP_D7., SP_D23cxx . . $ SP_D23.,
62 SP_D8cxx . . $ SP_D8., SP_D24cxx . . $ SP_D24., SP_D9cxx . . $ SP_D9., SP_D25cxx . . $ SP_D25.,
63 SP_D10cxx . . $ SP_D10., SP_D26cxx . . $ SP_D26., SP_D11cxx . . $ SP_D11., SP_D27cxx . . $ SP_D27.,
64 SP_D12cxx . . $ SP_D12., SP_D28cxx . . $ SP_D28., SP_D13cxx . . $ SP_D13., SP_D29cxx . . $ SP_D29.,
65 SP_D14cxx . . $ SP_D14., SP_D30cxx . . $ SP_D30., SP_D15cxx . . $ SP_D15., SP_D31cxx . . $ SP_D31.
66 };
67
68 static const unsigned QFPRegDecoderTablecxx . . $ QFPRegDecoderTable.[] = {
69 SP_Q0cxx . . $ SP_Q0., SP_Q8cxx . . $ SP_Q8., ~0U, ~0U,
70 SP_Q1cxx . . $ SP_Q1., SP_Q9cxx . . $ SP_Q9., ~0U, ~0U,
71 SP_Q2cxx . . $ SP_Q2., SP_Q10cxx . . $ SP_Q10., ~0U, ~0U,
72 SP_Q3cxx . . $ SP_Q3., SP_Q11cxx . . $ SP_Q11., ~0U, ~0U,
73 SP_Q4cxx . . $ SP_Q4., SP_Q12cxx . . $ SP_Q12., ~0U, ~0U,
74 SP_Q5cxx . . $ SP_Q5., SP_Q13cxx . . $ SP_Q13., ~0U, ~0U,
75 SP_Q6cxx . . $ SP_Q6., SP_Q14cxx . . $ SP_Q14., ~0U, ~0U,
76 SP_Q7cxx . . $ SP_Q7., SP_Q15cxx . . $ SP_Q15., ~0U, ~0U
77 };
78
79 static const unsigned FCCRegDecoderTablecxx . . $ FCCRegDecoderTable.[] = {
80 SP_FCC0cxx . . $ SP_FCC0., SP_FCC1cxx . . $ SP_FCC1., SP_FCC2cxx . . $ SP_FCC2., SP_FCC3cxx . . $ SP_FCC3.
81 };
82
83 static uint64_tcxx . . $ uint64_t# getFeatureBitscxx . . $ getFeatureBits(c104ebd7d68b2193).(int mode)
84 {
85 // support everything
86 return (uint64_tcxx . . $ uint64_t#)-1;
87 }
88
89 static DecodeStatuscxx . . $ DecodeStatus# DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned RegNo,
90 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
91 {
92 unsigned Reg;
93
94 if (RegNo > 31)
95 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
96
97 Reg = IntRegDecoderTablecxx . . $ IntRegDecoderTable.[RegNo];
98 MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Reg);
99
100 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
101 }
102
103 static DecodeStatuscxx . . $ DecodeStatus# DecodeI64RegsRegisterClasscxx . . $ DecodeI64RegsRegisterClass(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned RegNo,
104 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
105 {
106 unsigned Reg;
107
108 if (RegNo > 31)
109 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
110
111 Reg = IntRegDecoderTablecxx . . $ IntRegDecoderTable.[RegNo];
112 MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Reg);
113
114 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
115 }
116
117 static DecodeStatuscxx . . $ DecodeStatus# DecodeFPRegsRegisterClasscxx . . $ DecodeFPRegsRegisterClass(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned RegNo,
118 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
119 {
120 unsigned Reg;
121
122 if (RegNo > 31)
123 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
124
125 Reg = FPRegDecoderTablecxx . . $ FPRegDecoderTable.[RegNo];
126 MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Reg);
127
128 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
129 }
130
131 static DecodeStatuscxx . . $ DecodeStatus# DecodeDFPRegsRegisterClasscxx . . $ DecodeDFPRegsRegisterClass(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned RegNo,
132 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
133 {
134 unsigned Reg;
135
136 if (RegNo > 31)
137 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
138
139 Reg = DFPRegDecoderTablecxx . . $ DFPRegDecoderTable.[RegNo];
140 MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Reg);
141
142 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
143 }
144
145 static DecodeStatuscxx . . $ DecodeStatus# DecodeQFPRegsRegisterClasscxx . . $ DecodeQFPRegsRegisterClass(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned RegNo,
146 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
147 {
148 unsigned Reg;
149
150 if (RegNo > 31)
151 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
152
153 Reg = QFPRegDecoderTablecxx . . $ QFPRegDecoderTable.[RegNo];
154 if (Reg == ~0U)
155 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
156
157 MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, Reg);
158
159 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
160 }
161
162 static DecodeStatuscxx . . $ DecodeStatus# DecodeFCCRegsRegisterClasscxx . . $ DecodeFCCRegsRegisterClass(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned RegNo,
163 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
164 {
165 if (RegNo > 3)
166 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
167
168 MCOperand_CreateReg0cxx . . $ MCOperand_CreateReg0(1d3fdd902ae43da2).(Inst, FCCRegDecoderTablecxx . . $ FCCRegDecoderTable.[RegNo]);
169
170 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
171 }
172
173
174 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadIntcxx . . $ DecodeLoadInt(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
175 const void *Decoder);
176 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadFPcxx . . $ DecodeLoadFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
177 const void *Decoder);
178 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadDFPcxx . . $ DecodeLoadDFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
179 const void *Decoder);
180 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadQFPcxx . . $ DecodeLoadQFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
181 const void *Decoder);
182 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreIntcxx . . $ DecodeStoreInt(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
183 uint64_tcxx . . $ uint64_t# Address, const void *Decoder);
184 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreFPcxx . . $ DecodeStoreFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
185 uint64_tcxx . . $ uint64_t# Address, const void *Decoder);
186 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreDFPcxx . . $ DecodeStoreDFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
187 uint64_tcxx . . $ uint64_t# Address, const void *Decoder);
188 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreQFPcxx . . $ DecodeStoreQFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
189 uint64_tcxx . . $ uint64_t# Address, const void *Decoder);
190 static DecodeStatuscxx . . $ DecodeStatus# DecodeCallcxx . . $ DecodeCall(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
191 uint64_tcxx . . $ uint64_t# Address, const void *Decoder);
192 static DecodeStatuscxx . . $ DecodeStatus# DecodeSIMM13cxx . . $ DecodeSIMM13(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
193 uint64_tcxx . . $ uint64_t# Address, const void *Decoder);
194 static DecodeStatuscxx . . $ DecodeStatus# DecodeJMPLcxx . . $ DecodeJMPL(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
195 const void *Decoder);
196 static DecodeStatuscxx . . $ DecodeStatus# DecodeReturncxx . . $ DecodeReturn(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *MI, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
197 const void *Decoder);
198 static DecodeStatuscxx . . $ DecodeStatus# DecodeSWAPcxx . . $ DecodeSWAP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
199 const void *Decoder);
200
201
202 #define GET_SUBTARGETINFO_ENUMcxx . . $ `arch/Sparc/SparcDisassembler.c:202:9`!
203 #include "SparcGenSubtargetInfo.inc"cxx . . $ `<file>/arch/Sparc/SparcGenSubtargetInfo.inc`/
204 #include "SparcGenDisassemblerTables.inc"cxx . . $ `<file>/arch/Sparc/SparcGenDisassemblerTables.inc`/
205
206 /// readInstruction - read four bytes and return 32 bit word.
207 static DecodeStatuscxx . . $ DecodeStatus# readInstruction32cxx . . $ readInstruction32(a1750c02a01b35ab).(const uint8_tcxx . . $ uint8_t# *code, size_t len, uint32_tcxx . . $ uint32_t# *Insn)
208 {
209 if (len < 4)
210 // not enough data
211 return MCDisassembler_Failcxx . . $ MCDisassembler_Fail.;
212
213 // Encoded as a big-endian 32-bit word in the stream.
214 *Insn = (code[3] << 0) |
215 (code[2] << 8) |
216 (code[1] << 16) |
217 ((uint32_tcxx . . $ uint32_t#) code[0] << 24);
218
219 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
220 }
221
222 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! Sparc_getInstructioncxx . . $ Sparc_getInstruction(fe94ce91eeab61e9).(cshcxx . . $ csh# ud, const uint8_tcxx . . $ uint8_t# *code, size_t code_len, MCInstcxx . . $ MCInst# *MI,
223 uint16_tcxx . . $ uint16_t# *size, uint64_tcxx . . $ uint64_t# address, void *info)
224 {
225 uint32_tcxx . . $ uint32_t# Insn;
226 DecodeStatuscxx . . $ DecodeStatus# Result;
227
228 Result = readInstruction32cxx . . $ readInstruction32(a1750c02a01b35ab).(code, code_len, &Insn);
229 if (Result == MCDisassembler_Failcxx . . $ MCDisassembler_Fail.)
230 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
231
232 if (MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail.) {
233 memsetcxx . . $ memset(d1de1e4fb215f1c6).(MI->flat_insncxx . . $ MCInst#flat_insn.->detailcxx . . $ cs_insn#detail., 0, offsetofcxx . . $ `<external>/16391990256953433862/stddef.h:431:9`!(cs_detail, sparc)+sizeof(cs_sparccxx . . $ cs_sparc#));
234 }
235
236 Result = decodeInstruction_4cxx . . $ decodeInstruction_4(234353cd2c6bdd57).(DecoderTableSparc32cxx . . $ DecoderTableSparc32., MI, Insn, address,
237 (MCRegisterInfocxx . . $ MCRegisterInfo# *)info, 0);
238 if (Result != MCDisassembler_Failcxx . . $ MCDisassembler_Fail.) {
239 *size = 4;
240 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
241 }
242
243 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
244 }
245
246 typedef DecodeStatuscxx . . $ DecodeStatus# (*DecodeFunccxx . . $ DecodeFunc#)(MCInstcxx . . $ MCInst# *MI, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
247 const void *Decoder);
248
249 static DecodeStatuscxx . . $ DecodeStatus# DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(MCInstcxx . . $ MCInst# *MI, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
250 const void *Decoder,
251 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! isLoad, DecodeFunccxx . . $ DecodeFunc# DecodeRD)
252 {
253 DecodeStatuscxx . . $ DecodeStatus# status;
254 unsigned rd = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 25, 5);
255 unsigned rs1 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 14, 5);
256 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! isImm = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 13, 1) != 0;
257 unsigned rs2 = 0;
258 unsigned simm13 = 0;
259
260 if (isImm)
261 simm13 = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 13), 13);
262 else
263 rs2 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 5);
264
265 if (isLoad) {
266 status = DecodeRD(MI, rd, Address, Decoder);
267 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
268 return status;
269 }
270
271 // Decode rs1.
272 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs1, Address, Decoder);
273 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
274 return status;
275
276 // Decode imm|rs2.
277 if (isImm)
278 MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MI, simm13);
279 else {
280 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs2, Address, Decoder);
281 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
282 return status;
283 }
284
285 if (!isLoad) {
286 status = DecodeRD(MI, rd, Address, Decoder);
287 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
288 return status;
289 }
290
291 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
292 }
293
294 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadIntcxx . . $ DecodeLoadInt(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
295 const void *Decoder)
296 {
297 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!,
298 DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).);
299 }
300
301 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadFPcxx . . $ DecodeLoadFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
302 const void *Decoder)
303 {
304 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!,
305 DecodeFPRegsRegisterClasscxx . . $ DecodeFPRegsRegisterClass(cbc3db6d502b7505).);
306 }
307
308 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadDFPcxx . . $ DecodeLoadDFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
309 const void *Decoder)
310 {
311 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!,
312 DecodeDFPRegsRegisterClasscxx . . $ DecodeDFPRegsRegisterClass(cbc3db6d502b7505).);
313 }
314
315 static DecodeStatuscxx . . $ DecodeStatus# DecodeLoadQFPcxx . . $ DecodeLoadQFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
316 const void *Decoder)
317 {
318 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!,
319 DecodeQFPRegsRegisterClasscxx . . $ DecodeQFPRegsRegisterClass(cbc3db6d502b7505).);
320 }
321
322 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreIntcxx . . $ DecodeStoreInt(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
323 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
324 {
325 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
326 DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).);
327 }
328
329 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreFPcxx . . $ DecodeStoreFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
330 const void *Decoder)
331 {
332 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
333 DecodeFPRegsRegisterClasscxx . . $ DecodeFPRegsRegisterClass(cbc3db6d502b7505).);
334 }
335
336 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreDFPcxx . . $ DecodeStoreDFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
337 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
338 {
339 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
340 DecodeDFPRegsRegisterClasscxx . . $ DecodeDFPRegsRegisterClass(cbc3db6d502b7505).);
341 }
342
343 static DecodeStatuscxx . . $ DecodeStatus# DecodeStoreQFPcxx . . $ DecodeStoreQFP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *Inst, unsigned insn,
344 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
345 {
346 return DecodeMemcxx . . $ DecodeMem(24deae8c36165794).(Inst, insn, Address, Decoder, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
347 DecodeQFPRegsRegisterClasscxx . . $ DecodeQFPRegsRegisterClass(cbc3db6d502b7505).);
348 }
349
350 static DecodeStatuscxx . . $ DecodeStatus# DecodeCallcxx . . $ DecodeCall(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *MI, unsigned insn,
351 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
352 {
353 unsigned tgt = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 30);
354 tgt <<= 2;
355
356 MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MI, tgt);
357
358 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
359 }
360
361 static DecodeStatuscxx . . $ DecodeStatus# DecodeSIMM13cxx . . $ DecodeSIMM13(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *MI, unsigned insn,
362 uint64_tcxx . . $ uint64_t# Address, const void *Decoder)
363 {
364 unsigned tgt = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 13), 13);
365
366 MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MI, tgt);
367
368 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
369 }
370
371 static DecodeStatuscxx . . $ DecodeStatus# DecodeJMPLcxx . . $ DecodeJMPL(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *MI, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
372 const void *Decoder)
373 {
374 DecodeStatuscxx . . $ DecodeStatus# status;
375 unsigned rd = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 25, 5);
376 unsigned rs1 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 14, 5);
377 unsigned isImm = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 13, 1);
378 unsigned rs2 = 0;
379 unsigned simm13 = 0;
380
381 if (isImm)
382 simm13 = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 13), 13);
383 else
384 rs2 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 5);
385
386 // Decode RD.
387 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rd, Address, Decoder);
388 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
389 return status;
390
391 // Decode RS1.
392 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs1, Address, Decoder);
393 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
394 return status;
395
396 // Decode RS1 | SIMM13.
397 if (isImm)
398 MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MI, simm13);
399 else {
400 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs2, Address, Decoder);
401 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
402 return status;
403 }
404
405 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
406 }
407
408 static DecodeStatuscxx . . $ DecodeStatus# DecodeReturncxx . . $ DecodeReturn(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *MI, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
409 const void *Decoder)
410 {
411 DecodeStatuscxx . . $ DecodeStatus# status;
412 unsigned rs1 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 14, 5);
413 unsigned isImm = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 13, 1);
414 unsigned rs2 = 0;
415 unsigned simm13 = 0;
416 if (isImm)
417 simm13 = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 13), 13);
418 else
419 rs2 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 5);
420
421 // Decode RS1.
422 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs1, Address, Decoder);
423 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
424 return status;
425
426 // Decode RS2 | SIMM13.
427 if (isImm)
428 MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MI, simm13);
429 else {
430 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs2, Address, Decoder);
431 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
432 return status;
433 }
434
435 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
436 }
437
438 static DecodeStatuscxx . . $ DecodeStatus# DecodeSWAPcxx . . $ DecodeSWAP(cbc3db6d502b7505).(MCInstcxx . . $ MCInst# *MI, unsigned insn, uint64_tcxx . . $ uint64_t# Address,
439 const void *Decoder)
440 {
441 DecodeStatuscxx . . $ DecodeStatus# status;
442 unsigned rd = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 25, 5);
443 unsigned rs1 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 14, 5);
444 unsigned isImm = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 13, 1);
445 unsigned rs2 = 0;
446 unsigned simm13 = 0;
447
448 if (isImm)
449 simm13 = SignExtend32cxx . . $ SignExtend32(21cb2064190e2a90).(fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 13), 13);
450 else
451 rs2 = fieldFromInstruction_4cxx . . $ fieldFromInstruction_4(4eebda9b5e4ecc9c).(insn, 0, 5);
452
453 // Decode RD.
454 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rd, Address, Decoder);
455 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
456 return status;
457
458 // Decode RS1.
459 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs1, Address, Decoder);
460 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
461 return status;
462
463 // Decode RS1 | SIMM13.
464 if (isImm)
465 MCOperand_CreateImm0cxx . . $ MCOperand_CreateImm0(c25c894236a70359).(MI, simm13);
466 else {
467 status = DecodeIntRegsRegisterClasscxx . . $ DecodeIntRegsRegisterClass(cbc3db6d502b7505).(MI, rs2, Address, Decoder);
468 if (status != MCDisassembler_Successcxx . . $ MCDisassembler_Success.)
469 return status;
470 }
471
472 return MCDisassembler_Successcxx . . $ MCDisassembler_Success.;
473 }
474
475 void Sparc_initcxx . . $ Sparc_init(c2e0c34190506c3d).(MCRegisterInfocxx . . $ MCRegisterInfo# *MRI)
476 {
477 /*
478 InitMCRegisterInfo(SparcRegDesc, 119, RA, PC,
479 SparcMCRegisterClasses, 8,
480 SparcRegUnitRoots,
481 86,
482 SparcRegDiffLists,
483 SparcRegStrings,
484 SparcSubRegIdxLists,
485 7,
486 SparcSubRegIdxRanges,
487 SparcRegEncodingTable);
488 */
489
490 MCRegisterInfo_InitMCRegisterInfocxx . . $ MCRegisterInfo_InitMCRegisterInfo(5e86a0227010d6ff).(MRI, SparcRegDesccxx . . $ SparcRegDesc., 119,
491 0, 0,
492 SparcMCRegisterClassescxx . . $ SparcMCRegisterClasses., 8,
493 0, 0,
494 SparcRegDiffListscxx . . $ SparcRegDiffLists.,
495 0,
496 SparcSubRegIdxListscxx . . $ SparcSubRegIdxLists., 7,
497 0);
498 }
499
500 #endif