Rizin
unix-like reverse engineering framework and cli tools
X86.java
Go to the documentation of this file.
1
// Capstone Java binding
2
// By Nguyen Anh Quynh & Dang Hoang Vu, 2013
3
4
package
capstone;
5
6
import
com.sun.jna.Structure;
7
import
com.sun.jna.Union;
8
9
import
java.util.List;
10
import
java.util.Arrays;
11
12
import
static
capstone
.
X86_const
.*;
13
14
public
class
X86
{
15
16
public
static
class
MemType
extends
Structure {
17
public
int
segment
;
18
public
int
base
;
19
public
int
index
;
20
public
int
scale
;
21
public
long
disp
;
22
23
@Override
24
public
List
getFieldOrder
() {
25
return
Arrays.asList(
"segment"
,
"base"
,
"index"
,
"scale"
,
"disp"
);
26
}
27
}
28
29
public
static
class
Encoding
extends
Structure {
30
public
byte
modrmOffset
;
31
public
byte
dispOffset
;
32
public
byte
dispSize
;
33
public
byte
immOffset
;
34
public
byte
immSize
;
35
36
@Override
37
public
List
getFieldOrder
() {
38
return
Arrays.asList(
"modrmOffset"
,
"dispOffset"
,
"dispSize"
,
"immOffset"
,
"immSize"
);
39
}
40
}
41
42
public
static
class
OpValue
extends
Union {
43
public
int
reg
;
44
public
long
imm
;
45
public
MemType
mem
;
46
47
@Override
48
public
List
getFieldOrder
() {
49
return
Arrays.asList(
"reg"
,
"imm"
,
"mem"
);
50
}
51
}
52
53
public
static
class
Operand
extends
Structure {
54
public
int
type
;
55
public
OpValue
value
;
56
public
byte
size
;
57
public
byte
access
;
58
public
int
avx_bcast
;
59
public
boolean
avx_zero_opmask
;
60
61
public
void
read
() {
62
super.read();
63
if
(
type
==
X86_OP_MEM
)
64
value
.setType(
MemType
.class);
65
if
(
type
==
X86_OP_IMM
)
66
value
.setType(Long.TYPE);
67
if
(
type
==
X86_OP_REG
)
68
value
.setType(Integer.TYPE);
69
if
(
type
==
X86_OP_INVALID
)
70
return
;
71
readField(
"value"
);
72
}
73
74
@Override
75
public
List
getFieldOrder
() {
76
return
Arrays.asList(
"type"
,
"value"
,
"size"
,
"access"
,
"avx_bcast"
,
"avx_zero_opmask"
);
77
}
78
}
79
80
public
static
class
UnionOpInfo
extends
Capstone.
UnionOpInfo
{
81
public
byte
[]
prefix
;
82
public
byte
[]
opcode
;
83
public
byte
rex
;
84
public
byte
addr_size
;
85
public
byte
modrm
;
86
public
byte
sib
;
87
public
long
disp
;
88
public
int
sib_index
;
89
public
byte
sib_scale
;
90
public
int
sib_base
;
91
public
int
xop_cc
;
92
public
int
sse_cc
;
93
public
int
avx_cc
;
94
public
byte
avx_sae
;
95
public
int
avx_rm
;
96
public
long
eflags
;
97
98
public
byte
op_count
;
99
100
public
Operand
[]
op
;
101
102
public
Encoding
encoding
;
103
104
public
UnionOpInfo
() {
105
op
=
new
Operand
[8];
106
opcode
=
new
byte
[4];
107
prefix
=
new
byte
[4];
108
}
109
110
@Override
111
public
List
getFieldOrder
() {
112
return
Arrays.asList(
"prefix"
,
"opcode"
,
"rex"
,
"addr_size"
,
113
"modrm"
,
"sib"
,
"disp"
,
"sib_index"
,
"sib_scale"
,
"sib_base"
,
"xop_cc"
,
"sse_cc"
,
"avx_cc"
,
"avx_sae"
,
"avx_rm"
,
"eflags"
,
"op_count"
,
"op"
,
"encoding"
);
114
}
115
}
116
117
public
static
class
OpInfo
extends
Capstone.
OpInfo
{
118
public
byte
[]
prefix
;
119
public
byte
[]
opcode
;
120
public
byte
opSize
;
121
public
byte
rex
;
122
public
byte
addrSize
;
123
public
byte
dispSize
;
124
public
byte
immSize
;
125
public
byte
modrm
;
126
public
byte
sib
;
127
public
long
disp
;
128
public
int
sibIndex
;
129
public
byte
sibScale
;
130
public
int
sibBase
;
131
public
int
xopCC
;
132
public
int
sseCC
;
133
public
int
avxCC
;
134
public
boolean
avxSae
;
135
public
int
avxRm
;
136
public
long
eflags
;
137
138
public
Operand
[]
op
;
139
140
public
Encoding
encoding
;
141
142
public
OpInfo
(
UnionOpInfo
e
) {
143
prefix
=
e
.prefix;
144
opcode
=
e
.opcode;
145
rex
=
e
.rex;
146
addrSize
=
e
.addr_size;
147
modrm
=
e
.modrm;
148
sib
=
e
.sib;
149
disp
=
e
.disp;
150
sibIndex
=
e
.sib_index;
151
sibScale
=
e
.sib_scale;
152
sibBase
=
e
.sib_base;
153
xopCC
=
e
.xop_cc;
154
sseCC
=
e
.sse_cc;
155
avxCC
=
e
.avx_cc;
156
avxSae
=
e
.avx_sae > 0;
157
avxRm
=
e
.avx_rm;
158
eflags
=
e
.eflags;
159
op
=
new
Operand
[
e
.op_count];
160
for
(
int
i
=0;
i
<
e
.op_count;
i
++)
161
op
[
i
] =
e
.op[
i
];
162
encoding
=
e
.encoding;
163
}
164
}
165
}
e
#define e(frag)
Definition:
analysis_8051.c:218
i
lzma_index ** i
Definition:
index.h:629
X86_OP_IMM
@ X86_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition:
x86.h:161
X86_OP_INVALID
@ X86_OP_INVALID
= CS_OP_INVALID (Uninitialized).
Definition:
x86.h:159
X86_OP_REG
@ X86_OP_REG
= CS_OP_REG (Register operand).
Definition:
x86.h:160
X86_OP_MEM
@ X86_OP_MEM
= CS_OP_MEM (Memory operand).
Definition:
x86.h:162
capstone.X86.Encoding
Definition:
X86.java:29
capstone.X86.Encoding.immSize
byte immSize
Definition:
X86.java:34
capstone.X86.Encoding.dispSize
byte dispSize
Definition:
X86.java:32
capstone.X86.Encoding.dispOffset
byte dispOffset
Definition:
X86.java:31
capstone.X86.Encoding.immOffset
byte immOffset
Definition:
X86.java:33
capstone.X86.Encoding.getFieldOrder
List getFieldOrder()
Definition:
X86.java:37
capstone.X86.Encoding.modrmOffset
byte modrmOffset
Definition:
X86.java:30
capstone.X86.MemType
Definition:
X86.java:16
capstone.X86.MemType.getFieldOrder
List getFieldOrder()
Definition:
X86.java:24
capstone.X86.MemType.disp
long disp
Definition:
X86.java:21
capstone.X86.MemType.segment
int segment
Definition:
X86.java:17
capstone.X86.MemType.base
int base
Definition:
X86.java:18
capstone.X86.MemType.index
int index
Definition:
X86.java:19
capstone.X86.MemType.scale
int scale
Definition:
X86.java:20
capstone.X86.OpInfo
Definition:
X86.java:117
capstone.X86.OpInfo.modrm
byte modrm
Definition:
X86.java:125
capstone.X86.OpInfo.sibIndex
int sibIndex
Definition:
X86.java:128
capstone.X86.OpInfo.opSize
byte opSize
Definition:
X86.java:120
capstone.X86.OpInfo.opcode
byte[] opcode
Definition:
X86.java:119
capstone.X86.OpInfo.avxSae
boolean avxSae
Definition:
X86.java:134
capstone.X86.OpInfo.sib
byte sib
Definition:
X86.java:126
capstone.X86.OpInfo.immSize
byte immSize
Definition:
X86.java:124
capstone.X86.OpInfo.disp
long disp
Definition:
X86.java:127
capstone.X86.OpInfo.OpInfo
OpInfo(UnionOpInfo e)
Definition:
X86.java:142
capstone.X86.OpInfo.addrSize
byte addrSize
Definition:
X86.java:122
capstone.X86.OpInfo.prefix
byte[] prefix
Definition:
X86.java:118
capstone.X86.OpInfo.xopCC
int xopCC
Definition:
X86.java:131
capstone.X86.OpInfo.encoding
Encoding encoding
Definition:
X86.java:140
capstone.X86.OpInfo.dispSize
byte dispSize
Definition:
X86.java:123
capstone.X86.OpInfo.op
Operand[] op
Definition:
X86.java:138
capstone.X86.OpInfo.sibBase
int sibBase
Definition:
X86.java:130
capstone.X86.OpInfo.rex
byte rex
Definition:
X86.java:121
capstone.X86.OpInfo.sseCC
int sseCC
Definition:
X86.java:132
capstone.X86.OpInfo.avxRm
int avxRm
Definition:
X86.java:135
capstone.X86.OpInfo.avxCC
int avxCC
Definition:
X86.java:133
capstone.X86.OpInfo.eflags
long eflags
Definition:
X86.java:136
capstone.X86.OpInfo.sibScale
byte sibScale
Definition:
X86.java:129
capstone.X86.OpValue
Definition:
X86.java:42
capstone.X86.OpValue.mem
MemType mem
Definition:
X86.java:45
capstone.X86.OpValue.imm
long imm
Definition:
X86.java:44
capstone.X86.OpValue.reg
int reg
Definition:
X86.java:43
capstone.X86.OpValue.getFieldOrder
List getFieldOrder()
Definition:
X86.java:48
capstone.X86.Operand
Definition:
X86.java:53
capstone.X86.Operand.access
byte access
Definition:
X86.java:57
capstone.X86.Operand.size
byte size
Definition:
X86.java:56
capstone.X86.Operand.value
OpValue value
Definition:
X86.java:55
capstone.X86.Operand.getFieldOrder
List getFieldOrder()
Definition:
X86.java:75
capstone.X86.Operand.avx_zero_opmask
boolean avx_zero_opmask
Definition:
X86.java:59
capstone.X86.Operand.read
void read()
Definition:
X86.java:61
capstone.X86.Operand.type
int type
Definition:
X86.java:54
capstone.X86.Operand.avx_bcast
int avx_bcast
Definition:
X86.java:58
capstone.X86.UnionOpInfo
Definition:
X86.java:80
capstone.X86.UnionOpInfo.encoding
Encoding encoding
Definition:
X86.java:102
capstone.X86.UnionOpInfo.sse_cc
int sse_cc
Definition:
X86.java:92
capstone.X86.UnionOpInfo.sib_index
int sib_index
Definition:
X86.java:88
capstone.X86.UnionOpInfo.opcode
byte[] opcode
Definition:
X86.java:82
capstone.X86.UnionOpInfo.avx_rm
int avx_rm
Definition:
X86.java:95
capstone.X86.UnionOpInfo.disp
long disp
Definition:
X86.java:87
capstone.X86.UnionOpInfo.getFieldOrder
List getFieldOrder()
Definition:
X86.java:111
capstone.X86.UnionOpInfo.modrm
byte modrm
Definition:
X86.java:85
capstone.X86.UnionOpInfo.avx_cc
int avx_cc
Definition:
X86.java:93
capstone.X86.UnionOpInfo.sib_base
int sib_base
Definition:
X86.java:90
capstone.X86.UnionOpInfo.xop_cc
int xop_cc
Definition:
X86.java:91
capstone.X86.UnionOpInfo.UnionOpInfo
UnionOpInfo()
Definition:
X86.java:104
capstone.X86.UnionOpInfo.sib
byte sib
Definition:
X86.java:86
capstone.X86.UnionOpInfo.avx_sae
byte avx_sae
Definition:
X86.java:94
capstone.X86.UnionOpInfo.op
Operand[] op
Definition:
X86.java:100
capstone.X86.UnionOpInfo.rex
byte rex
Definition:
X86.java:83
capstone.X86.UnionOpInfo.eflags
long eflags
Definition:
X86.java:96
capstone.X86.UnionOpInfo.op_count
byte op_count
Definition:
X86.java:98
capstone.X86.UnionOpInfo.addr_size
byte addr_size
Definition:
X86.java:84
capstone.X86.UnionOpInfo.sib_scale
byte sib_scale
Definition:
X86.java:89
capstone.X86.UnionOpInfo.prefix
byte[] prefix
Definition:
X86.java:81
capstone.X86_const
Definition:
X86_const.java:4
capstone.X86
Definition:
X86.java:14
capstone
Definition:
Arm.java:4
op
Definition:
dis.c:32
subprojects
capstone-bundled
bindings
java
capstone
X86.java
Generated by
1.9.1