mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-28 16:00:39 +00:00
Merge branch 'v3' of https://github.com/aquynh/capstone into v3
This commit is contained in:
commit
c7fa8fa6fc
@ -11018,7 +11018,7 @@ static insn_map insns[] = {
|
||||
{
|
||||
ARM_t2BXJ, ARM_INS_BXJ,
|
||||
#ifndef CAPSTONE_DIET
|
||||
{ 0 }, { 0 }, { ARM_GRP_THUMB2, 0 }, 0, 0
|
||||
{ 0 }, { 0 }, { ARM_GRP_THUMB2, ARM_GRP_NOTMCLASS, ARM_GRP_PREV8, 0 }, 0, 0
|
||||
#endif
|
||||
},
|
||||
{
|
||||
|
@ -224,6 +224,10 @@ public class Capstone {
|
||||
return cs.cs_insn_name(csh, id);
|
||||
}
|
||||
|
||||
public String groupName(int id) {
|
||||
return cs.cs_group_name(csh, id);
|
||||
}
|
||||
|
||||
public boolean group(int gid) {
|
||||
return cs.cs_insn_group(csh, raw.getPointer(), gid) != 0;
|
||||
}
|
||||
@ -253,6 +257,7 @@ public class Capstone {
|
||||
public int cs_op_index(NativeLong csh, Pointer insn, int type, int index);
|
||||
|
||||
public String cs_insn_name(NativeLong csh, int id);
|
||||
public String cs_group_name(NativeLong csh, int id);
|
||||
public byte cs_insn_group(NativeLong csh, Pointer insn, int id);
|
||||
public byte cs_reg_read(NativeLong csh, Pointer insn, int id);
|
||||
public byte cs_reg_write(NativeLong csh, Pointer insn, int id);
|
||||
|
@ -55,6 +55,8 @@ cdef extern from "<capstone/capstone.h>":
|
||||
|
||||
const char *cs_insn_name(csh handle, unsigned int insn_id)
|
||||
|
||||
const char *cs_group_name(csh handle, unsigned int group_id)
|
||||
|
||||
bool cs_insn_group(csh handle, cs_insn *insn, unsigned int group_id)
|
||||
|
||||
bool cs_reg_read(csh handle, cs_insn *insn, unsigned int reg_id)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
cimport pyx.ccapstone as cc
|
||||
import capstone, ctypes
|
||||
from capstone import arm, x86, mips, ppc, arm64, sparc, systemz, CsError
|
||||
from capstone import arm, x86, mips, ppc, arm64, sparc, systemz, xcore, CsError
|
||||
|
||||
_diet = cc.cs_support(capstone.CS_SUPPORT_DIET)
|
||||
|
||||
@ -22,15 +22,18 @@ class CsDetail(object):
|
||||
self.groups_count = detail.groups_count
|
||||
|
||||
if arch == capstone.CS_ARCH_ARM:
|
||||
(self.cc, self.update_flags, self.writeback, self.operands) = \
|
||||
(self.usermode, self.vector_size, self.vector_data, self.cps_mode, self.cps_flag, \
|
||||
self.cc, self.update_flags, self.writeback, self.operands) = \
|
||||
arm.get_arch_info(detail.arch.arm)
|
||||
elif arch == capstone.CS_ARCH_ARM64:
|
||||
(self.cc, self.update_flags, self.writeback, self.operands) = \
|
||||
arm64.get_arch_info(detail.arch.arm64)
|
||||
elif arch == capstone.CS_ARCH_X86:
|
||||
(self.prefix, self.segment, self.opcode, self.op_size, self.addr_size, \
|
||||
self.disp_size, self.imm_size, self.modrm, self.sib, self.disp, \
|
||||
self.sib_index, self.sib_scale, self.sib_base, self.operands) = x86.get_arch_info(detail.arch.x86)
|
||||
(self.prefix, self.opcode, self.rex, self.addr_size, \
|
||||
self.modrm, self.sib, self.disp, \
|
||||
self.sib_index, self.sib_scale, self.sib_base, \
|
||||
self.sse_cc, self.avx_cc, self.avx_sae, self.avx_rm, \
|
||||
self.operands) = x86.get_arch_info(detail.arch.x86)
|
||||
elif arch == capstone.CS_ARCH_MIPS:
|
||||
self.operands = mips.get_arch_info(detail.arch.mips)
|
||||
elif arch == capstone.CS_ARCH_PPC:
|
||||
@ -40,6 +43,8 @@ class CsDetail(object):
|
||||
(self.cc, self.hint, self.operands) = sparc.get_arch_info(detail.arch.sparc)
|
||||
elif arch == capstone.CS_ARCH_SYSZ:
|
||||
(self.cc, self.operands) = systemz.get_arch_info(detail.arch.sysz)
|
||||
elif arch == capstone.CS_ARCH_XCORE:
|
||||
self.operands = xcore.get_arch_info(detail.arch.xcore)
|
||||
|
||||
|
||||
cdef class CsInsn(object):
|
||||
@ -172,6 +177,14 @@ cdef class CsInsn(object):
|
||||
|
||||
return cc.cs_insn_name(self._csh, self.id)
|
||||
|
||||
# get the group string
|
||||
def group_name(self, group_id):
|
||||
if _diet:
|
||||
# Diet engine cannot provide group's name
|
||||
raise CsError(capstone.CS_ERR_DIET)
|
||||
|
||||
return cc.cs_group_name(self._csh, group_id)
|
||||
|
||||
# verify if this insn belong to group with id as @group_id
|
||||
def group(self, group_id):
|
||||
if self._raw.id == 0:
|
||||
|
Loading…
Reference in New Issue
Block a user