blob: 1bc5ed70902a3230dcb01c4d1039f01c009db42c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
// Capstone Java binding
// By Nguyen Anh Quynh & Dang Hoang Vu, 2013
package capstone;
import com.sun.jna.Structure;
import com.sun.jna.Union;
import java.util.List;
import java.util.Arrays;
import static capstone.Sysz_const.*;
public class Systemz {
public static class MemType extends Structure {
public byte base;
public byte index;
public long length;
public long disp;
@Override
public List getFieldOrder() {
return Arrays.asList("base", "index", "length", "disp");
}
}
public static class OpValue extends Union {
public int reg;
public long imm;
public MemType mem;
}
public static class Operand extends Structure {
public int type;
public OpValue value;
public void read() {
readField("type");
if (type == SYSZ_OP_MEM)
value.setType(MemType.class);
if (type == SYSZ_OP_IMM)
value.setType(Long.TYPE);
if (type == SYSZ_OP_REG || type == SYSZ_OP_ACREG)
value.setType(Integer.TYPE);
if (type == SYSZ_OP_INVALID)
return;
readField("value");
}
@Override
public List getFieldOrder() {
return Arrays.asList("type", "value");
}
}
public static class UnionOpInfo extends Capstone.UnionOpInfo {
public int cc;
public byte op_count;
public Operand [] op;
public UnionOpInfo() {
op = new Operand[6];
}
public void read() {
readField("cc");
readField("op_count");
op = new Operand[op_count];
if (op_count != 0)
readField("op");
}
@Override
public List getFieldOrder() {
return Arrays.asList("cc", "op_count", "op");
}
}
public static class OpInfo extends Capstone.OpInfo {
public int cc;
public Operand [] op;
public OpInfo(UnionOpInfo op_info) {
cc = op_info.cc;
op = op_info.op;
}
}
}
|