Rizin
unix-like reverse engineering framework and cli tools
m680x.py
Go to the documentation of this file.
1
# Capstone Python bindings, by Wolfgang Schwotzer <wolfgang.schwotzer@gmx.net>
2
3
import
ctypes
4
from
.
import
copy_ctypes_list
5
from
.m680x_const
import
*
6
7
# define the API
8
class
M680xOpIdx
(ctypes.Structure):
9
_fields_ = (
10
(
'base_reg'
, ctypes.c_uint),
11
(
'offset_reg'
, ctypes.c_uint),
12
(
'offset'
, ctypes.c_int16),
13
(
'offset_addr'
, ctypes.c_uint16),
14
(
'offset_bits'
, ctypes.c_uint8),
15
(
'inc_dec'
, ctypes.c_int8),
16
(
'flags'
, ctypes.c_uint8),
17
)
18
19
class
M680xOpRel
(ctypes.Structure):
20
_fields_ = (
21
(
'address'
, ctypes.c_uint16),
22
(
'offset'
, ctypes.c_int16),
23
)
24
25
class
M680xOpExt
(ctypes.Structure):
26
_fields_ = (
27
(
'address'
, ctypes.c_uint16),
28
(
'indirect'
, ctypes.c_bool),
29
)
30
31
class
M680xOpValue
(ctypes.Union):
32
_fields_ = (
33
(
'imm'
, ctypes.c_int32),
34
(
'reg'
, ctypes.c_uint),
35
(
'idx'
, M680xOpIdx),
36
(
'rel'
, M680xOpRel),
37
(
'ext'
, M680xOpExt),
38
(
'direct_addr'
, ctypes.c_uint8),
39
(
'const_val'
, ctypes.c_uint8),
40
)
41
42
class
M680xOp
(ctypes.Structure):
43
_fields_ = (
44
(
'type'
, ctypes.c_uint),
45
(
'value'
, M680xOpValue),
46
(
'size'
, ctypes.c_uint8),
47
(
'access'
, ctypes.c_uint8),
48
)
49
50
@property
51
def
imm
(self):
52
return
self.value.imm
53
54
@property
55
def
reg
(self):
56
return
self.value.reg
57
58
@property
59
def
idx
(self):
60
return
self.value.idx
61
62
@property
63
def
rel
(self):
64
return
self.value.rel
65
66
@property
67
def
ext
(self):
68
return
self.value.ext
69
70
@property
71
def
direct_addr
(self):
72
return
self.value.direct_addr
73
74
@property
75
def
const_val
(self):
76
return
self.value.const_val
77
78
79
class
CsM680x
(ctypes.Structure):
80
_fields_ = (
81
(
'flags'
, ctypes.c_uint8),
82
(
'op_count'
, ctypes.c_uint8),
83
(
'operands'
, M680xOp * 9),
84
)
85
86
def
get_arch_info
(a):
87
return
(a.flags,
copy_ctypes_list
(a.operands[:a.op_count]))
88
capstone.m680x.CsM680x
Definition:
m680x.py:79
capstone.m680x.M680xOpExt
Definition:
m680x.py:25
capstone.m680x.M680xOpIdx
Definition:
m680x.py:8
capstone.m680x.M680xOpRel
Definition:
m680x.py:19
capstone.m680x.M680xOpValue
Definition:
m680x.py:31
capstone.m680x.M680xOp
Definition:
m680x.py:42
capstone.m680x.M680xOp.const_val
def const_val(self)
Definition:
m680x.py:75
capstone.m680x.M680xOp.ext
def ext(self)
Definition:
m680x.py:67
capstone.m680x.M680xOp.imm
def imm(self)
Definition:
m680x.py:51
capstone.m680x.M680xOp.rel
def rel(self)
Definition:
m680x.py:63
capstone.m680x.M680xOp.direct_addr
def direct_addr(self)
Definition:
m680x.py:71
capstone.m680x.M680xOp.idx
def idx(self)
Definition:
m680x.py:59
capstone.m680x.M680xOp.reg
def reg(self)
Definition:
m680x.py:55
capstone.m680x.get_arch_info
def get_arch_info(a)
Definition:
m680x.py:86
capstone.copy_ctypes_list
def copy_ctypes_list(src)
Definition:
__init__.py:326
subprojects
capstone-bundled
bindings
python
capstone
m680x.py
Generated by
1.9.1