73 #include <lib/isa-lean/mips/instruction-set.h> 79 #if defined(HOST_PLATFORM_MIPS64LE_LINUX) 80 # define BFD_GETX32 bfd_getl32 81 # define BFD_PRINT_INSN_MIPS print_insn_little_mips 83 # define BFD_GETX32 bfd_getb32 84 # define BFD_PRINT_INSN_MIPS print_insn_big_mips 105 ostream* os = (ostream*)di->stream;
106 *os << std::showbase << std::hex << x << std::dec;
119 m_di =
new disassemble_info;
121 m_di->arch = bfd_arch_mips;
122 m_di->mach = bfd_mach_mipsisa64r2;
123 #if defined(HOST_PLATFORM_MIPS64LE_LINUX) 124 m_di->endian = BFD_ENDIAN_LITTLE;
126 m_di->endian = BFD_ENDIAN_BIG;
155 uint32_t insn = (uint32_t)
BFD_GETX32((
const unsigned char*)
mi);
157 switch (insn & MIPS_OPCODE_MASK)
159 case MIPS_OPClass_Special:
160 switch (insn & MIPS_OPClass_Special_MASK)
164 if (MIPS_OPND_REG_S(insn) == MIPS_REG_RA) {
173 case MIPS_OP_SYSCALL:
187 case MIPS_OPClass_RegImm:
188 switch (insn & MIPS_OPClass_RegImm_MASK)
198 case MIPS_OP_BLTZALL:
199 case MIPS_OP_BGEZALL:
211 case MIPS_OPClass_Cop1x:
212 switch (insn & MIPS_OPClass_Cop1x_MASK)
276 if (MIPS_OPND_REG_S(insn) == MIPS_OPND_REG_T(insn))
303 uint32_t insn = (uint32_t)
BFD_GETX32((
const unsigned char*)
mi);
306 switch (insn & MIPS_OPCODE_MASK)
308 case MIPS_OPClass_Special:
309 switch (insn & MIPS_OPClass_Special_MASK)
316 case MIPS_OPClass_RegImm:
317 switch (insn & MIPS_OPClass_RegImm_MASK)
325 case MIPS_OP_BLTZALL:
326 case MIPS_OP_BGEZALL:
328 offset = MIPS_OPND_IMM(insn);
329 if (offset & MIPS_OPND_IMM_SIGN) {
330 offset |= ~MIPS_OPND_IMM_MASK;
341 offset = MIPS_OPND_INSN_INDEX(insn) << 2;
342 return (((pc +
MINSN_SIZE) & MIPS_OPND_INSN_INDEX_UPPER_MASK) | offset);
353 offset = MIPS_OPND_IMM(insn);
354 if (offset & MIPS_OPND_IMM_SIGN) {
355 offset |= ~MIPS_OPND_IMM_MASK;
struct disassemble_info * m_di
int GNUbu_fprintf(void *stream, const char *format,...)
struct disassemble_info * m_di_dis
int GNUbu_fprintf_stub(void *GCC_ATTR_UNUSED stream, const char *GCC_ATTR_UNUSED format,...)
static void GNUbu_print_addr(bfd_vma di_vma, struct disassemble_info *di)
virtual ushort getInsnNumDelaySlots(MachInsn *mi, ushort opIndex, ushort sz=0)
static const ushort MINSN_SIZE
unsigned short int ushort
#define BFD_PRINT_INSN_MIPS
virtual void decode(std::ostream &os, MachInsn *mi, VMA vma, ushort opIndex)
virtual InsnDesc getInsnDesc(MachInsn *mi, ushort opIndex, ushort sz=0)
int GNUbu_read_memory(bfd_vma vma, bfd_byte *myaddr, unsigned int len, struct disassemble_info *GCC_ATTR_UNUSED di)
void GNUbu_print_addr_stub(bfd_vma GCC_ATTR_UNUSED di_vma, struct disassemble_info *GCC_ATTR_UNUSED di)
virtual VMA getInsnTargetVMA(MachInsn *mi, VMA pc, ushort opIndex, ushort sz=0)
static VMA GNUvma2vma(bfd_vma di_vma, MachInsn *insn_addr, VMA insn_vma)