Rizin
unix-like reverse engineering framework and cli tools
xcore.py
Go to the documentation of this file.
1 # Capstone Python bindings, by Nguyen Anh Quynnh <aquynh@gmail.com>
2 
3 import ctypes
4 from . import copy_ctypes_list
5 from .xcore_const import *
6 
7 # define the API
8 class XcoreOpMem(ctypes.Structure):
9  _fields_ = (
10  ('base', ctypes.c_uint8),
11  ('index', ctypes.c_uint8),
12  ('disp', ctypes.c_int32),
13  ('direct', ctypes.c_int),
14  )
15 
16 class XcoreOpValue(ctypes.Union):
17  _fields_ = (
18  ('reg', ctypes.c_uint),
19  ('imm', ctypes.c_int32),
20  ('mem', XcoreOpMem),
21  )
22 
23 class XcoreOp(ctypes.Structure):
24  _fields_ = (
25  ('type', ctypes.c_uint),
26  ('value', XcoreOpValue),
27  )
28 
29  @property
30  def imm(self):
31  return self.value.imm
32 
33  @property
34  def reg(self):
35  return self.value.reg
36 
37  @property
38  def mem(self):
39  return self.value.mem
40 
41 
42 class CsXcore(ctypes.Structure):
43  _fields_ = (
44  ('op_count', ctypes.c_uint8),
45  ('operands', XcoreOp * 8),
46  )
47 
49  return (copy_ctypes_list(a.operands[:a.op_count]))
50 
def imm(self)
Definition: xcore.py:30
def reg(self)
Definition: xcore.py:34
def mem(self)
Definition: xcore.py:38
def get_arch_info(a)
Definition: xcore.py:48
def copy_ctypes_list(src)
Definition: __init__.py:326