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

Function disassemble

arch/arm64/disassembler/test.c:187–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187int disassemble(uint64_t address, uint32_t insword, char* result)
188{
189 int rc;
190 Instruction instr;
191 memset(&instr, 0, sizeof(instr));
192
193 rc = aarch64_decompose(insword, &instr, address);
194 if (verbose)
195 printf("aarch64_decompose() returned %d\n", rc);
196 if (rc)
197 return rc;
198
199 if (verbose)
200 {
201 printf(" instr.insword: %08X\n", instr.insword);
202 printf(" instr.encoding: %d %s\n", instr.encoding, enc_to_str(instr.encoding));
203 printf("instr.operation: %d %s\n", instr.operation, operation_to_str(instr.operation));
204 printf(" instr.setflags: %d\n", instr.setflags);
205 for (int i = 0; i < MAX_OPERANDS && instr.operands[i].operandClass != NONE; i++)
206 {
207 printf("instr.operands[%d]\n", i);
208
209 InstructionOperand operand = instr.operands[i];
210
211 /* class */
212 printf("\t.class: %d (\"%s\")\n", operand.operandClass, oper_class_to_str(operand.operandClass));
213 switch (operand.operandClass)
214 {
215 case CONDITION:
216 printf("\t\t%d %s\n", operand.cond, cond_to_str(operand.cond));
217 break;
218 case FIMM32:
219 printf("\t\t%f\n", *(float*)&(operand.immediate));
220 break;
221 case IMM32:
222 printf("\t.imm32: 0x%llX\n", operand.immediate & 0xFFFFFFFF);
223 break;
224 case IMM64:
225 printf("\t.imm64: 0x%llX\n", operand.immediate);
226 break;
227 case NAME:
228 printf("\t.name: %s\n", operand.name);
229 break;
230 default:
231 break;
232 }
233 /* lane */
234 if (operand.laneUsed)
235 printf("\t.lane: %d\n", operand.lane);
236 /* shift */
237 if (operand.shiftType != ShiftType_NONE)
238 {
239 printf("\t.shiftType: %d (%s)\n", operand.shiftType, shifttype_to_str(operand.shiftType));
240 }
241 /* arrangement spec */
242 printf("\t.arrSpec: %d %s\n", operand.arrSpec, arrspec_to_str(operand.arrSpec));
243 }
244 }

Callers 1

mainFunction · 0.70

Calls 8

aarch64_decomposeFunction · 0.85
enc_to_strFunction · 0.85
operation_to_strFunction · 0.85
oper_class_to_strFunction · 0.85
cond_to_strFunction · 0.85
shifttype_to_strFunction · 0.85
arrspec_to_strFunction · 0.85
aarch64_disassembleFunction · 0.85

Tested by

no test coverage detected