1 // Copyright 2006 The Android Open Source Project 2 3 #ifndef ARMDIS_H 4 #define ARMDIS_H 5 6 #include <inttypes.h> 7 #include "opcode.h" 8 9 class Arm { 10 public: 11 static char *disasm(uint32_t addr, uint32_t insn, char *buffer); 12 static Opcode decode(uint32_t insn); 13 14 private: 15 static Opcode decode00(uint32_t insn); 16 static Opcode decode01(uint32_t insn); 17 static Opcode decode10(uint32_t insn); 18 static Opcode decode11(uint32_t insn); 19 static Opcode decode_mul(uint32_t insn); 20 static Opcode decode_ldrh(uint32_t insn); 21 static Opcode decode_alu(uint32_t insn); 22 23 static char *disasm_alu(Opcode opcode, uint32_t insn, char *ptr); 24 static char *disasm_branch(uint32_t addr, Opcode opcode, uint32_t insn, char *ptr); 25 static char *disasm_bx(uint32_t insn, char *ptr); 26 static char *disasm_bkpt(uint32_t insn, char *ptr); 27 static char *disasm_clz(uint32_t insn, char *ptr); 28 static char *disasm_memblock(Opcode opcode, uint32_t insn, char *ptr); 29 static char *disasm_mem(uint32_t insn, char *ptr); 30 static char *disasm_memhalf(uint32_t insn, char *ptr); 31 static char *disasm_mcr(Opcode opcode, uint32_t insn, char *ptr); 32 static char *disasm_mla(Opcode opcode, uint32_t insn, char *ptr); 33 static char *disasm_umlal(Opcode opcode, uint32_t insn, char *ptr); 34 static char *disasm_mul(Opcode opcode, uint32_t insn, char *ptr); 35 static char *disasm_mrs(uint32_t insn, char *ptr); 36 static char *disasm_msr(uint32_t insn, char *ptr); 37 static char *disasm_pld(uint32_t insn, char *ptr); 38 static char *disasm_swi(uint32_t insn, char *ptr); 39 static char *disasm_swp(Opcode opcode, uint32_t insn, char *ptr); 40 }; 41 42 extern char *disasm_insn_thumb(uint32_t pc, uint32_t insn1, uint32_t insn2, char *result); 43 extern Opcode decode_insn_thumb(uint32_t given); 44 45 #endif /* ARMDIS_H */ 46