MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / powerpc_decompose

Function powerpc_decompose

arch/powerpc/disassembler.cpp:214–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214extern "C" int
215powerpc_decompose(const uint8_t *data, int size, uint64_t addr, bool lil_end,
216 struct decomp_result *res, bool is_64bit, int cs_mode_arg)
217{
218 int rc = -1;
219 res->status = STATUS_ERROR_UNSPEC;
220
221 if(!handle_lil) {
222 powerpc_init(cs_mode_arg);
223 }
224
225 //typedef struct cs_insn {
226 // unsigned int id; /* see capstone/ppc.h for PPC_INS_ADD, etc. */
227 // uint64_t address;
228 // uint16_t size;
229 // uint8_t bytes[16];
230 // char mnemonic[32]; /* string */
231 // char op_str[160]; /* string */
232 // cs_detail *detail; /* need CS_OP_DETAIL ON and CS_OP_SKIPDATA is OFF */
233 //} cs_insn;
234
235 // where cs_detail is some details + architecture specific part
236 // typedef struct cs_detail {
237 // uint8_t regs_read[12];
238 // uint8_t regs_read_count;
239 // uint8_t regs_write;
240 // uint8_t regs_write_count;
241 // uint8_t groups[8];
242 // uint8_t groups_count;
243 // cs_ppc *ppc;
244 // }
245
246 // and finally ppc is:
247 // typedef struct cs_ppc {
248 // ppc_bc bc; /* branch code, see capstone/ppc.h for PPC_BC_LT, etc. */
249 // ppc_bh bh; /* branch hint, see capstone/ppc.h for PPC_BH_PLUS, etc. */
250 // bool update_cr0;
251 // uint8_t op_count;
252 // cs_ppc_op operands[8];
253 // } cs_ppc;
254
255 // and each operand is:
256 // typedef struct cs_ppc_op {
257 // ppc_op_type type; /* see capstone/ppc.h for PPC_OP_REG, etc. */
258 // union {
259 // unsigned int reg; // register value for REG operand
260 // int32_t imm; // immediate value for IMM operand
261 // ppc_op_mem mem; // struct ppc_op_mem { uint base; int disp }
262 // ppc_op_crx crx; // struct ppc_op_crx { uint scale, uint reg }
263 // };
264 // } cs_ppc_op;
265
266 csh handle;
267 struct cs_struct *hand_tmp = 0;
268 cs_insn *insn = 0; /* instruction information
269 cs_disasm() will allocate array of cs_insn here */
270
271 /* which handle to use?

Callers 4

GetInstructionInfoMethod · 0.85
GetInstructionTextMethod · 0.85
disas_instr_wordFunction · 0.85

Calls 1

powerpc_initFunction · 0.85

Tested by 1

disas_instr_wordFunction · 0.68