77 #include <xed-interface.h> 82 #if defined (HOST_CPU_x86_64) 83 { XED_MACHINE_MODE_LONG_64,
84 XED_ADDRESS_WIDTH_64b };
86 { XED_MACHINE_MODE_LONG_COMPAT_32,
87 XED_ADDRESS_WIDTH_32b };
92 static xed_decoded_inst_t
xedd;
94 static xed_decoded_inst_t*
103 xed_decoded_inst_t *xptr = &
xedd;
106 xed_decoded_inst_zero_keep_mode(xptr);
108 xed_error_enum_t xed_error = xed_decode(xptr, (uint8_t*)
mi, 15);
109 if (xed_error == XED_ERROR_NONE) {
144 xed_operand_values_t *vals;
145 xed_iclass_enum_t xiclass = xed_decoded_inst_get_iclass(xptr);
148 case XED_ICLASS_INVALID:
153 case XED_ICLASS_JMP:
case XED_ICLASS_JMP_FAR:
154 vals = xed_decoded_inst_operands(xptr);
155 offset = xed_operand_values_get_branch_displacement_int32(vals);
164 case XED_ICLASS_RET_FAR:
case XED_ICLASS_RET_NEAR:
169 case XED_ICLASS_JB:
case XED_ICLASS_JBE:
170 case XED_ICLASS_JL:
case XED_ICLASS_JLE:
171 case XED_ICLASS_JNB:
case XED_ICLASS_JNBE:
172 case XED_ICLASS_JNL:
case XED_ICLASS_JNLE:
173 case XED_ICLASS_JNO:
case XED_ICLASS_JNP:
174 case XED_ICLASS_JNS:
case XED_ICLASS_JNZ:
175 case XED_ICLASS_JO:
case XED_ICLASS_JP:
176 case XED_ICLASS_JRCXZ:
case XED_ICLASS_JS:
178 vals = xed_decoded_inst_operands(xptr);
179 offset = xed_operand_values_get_branch_displacement_int32(vals);
187 case XED_ICLASS_CALL_FAR:
188 case XED_ICLASS_CALL_NEAR:
189 vals = xed_decoded_inst_operands(xptr);
190 offset = xed_operand_values_get_branch_displacement_int32(vals);
215 return (
ushort)xed_decoded_inst_get_length(xptr);
226 xed_operand_values_t *vals = xed_decoded_inst_operands(xptr);
227 int offset = xed_operand_values_get_branch_displacement_int32(vals);
229 int len = xed_decoded_inst_get_length(xptr);
230 char* insn_end = (
char*)mi + len;
231 VMA absoluteTarget = (
VMA)(insn_end + offset);
233 if (absoluteTarget != 0) {
235 return relativeTarget;
static xed_decoded_inst_t * getDecodeXED(MachInsn *cmi)
static xed_state_t xed_machine_state
virtual VMA getInsnTargetVMA(MachInsn *mi, VMA vma, ushort opIndex, ushort sz=0)
unsigned short int ushort
static xed_decoded_inst_t xedd
static VMA GNUvma2vma(bfd_vma di_vma, MachInsn *GCC_ATTR_UNUSED insn_addr, VMA insn_vma)
virtual InsnDesc getInsnDesc(MachInsn *mi, ushort opIndex, ushort sz=0)
x86ISAXed(bool is_x86_64=false)
virtual ushort getInsnSize(MachInsn *mi)