Rizin
unix-like reverse engineering framework and cli tools
Systemz.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.Sysz_const.*;
13 
14 public class Systemz {
15 
16  public static class MemType extends Structure {
17  public byte base;
18  public byte index;
19  public long length;
20  public long disp;
21 
22  @Override
23  public List getFieldOrder() {
24  return Arrays.asList("base", "index", "length", "disp");
25  }
26  }
27 
28  public static class OpValue extends Union {
29  public int reg;
30  public long imm;
31  public MemType mem;
32  }
33 
34  public static class Operand extends Structure {
35  public int type;
36  public OpValue value;
37 
38  public void read() {
39  readField("type");
40  if (type == SYSZ_OP_MEM)
41  value.setType(MemType.class);
42  if (type == SYSZ_OP_IMM)
43  value.setType(Long.TYPE);
44  if (type == SYSZ_OP_REG || type == SYSZ_OP_ACREG)
45  value.setType(Integer.TYPE);
46  if (type == SYSZ_OP_INVALID)
47  return;
48  readField("value");
49  }
50 
51  @Override
52  public List getFieldOrder() {
53  return Arrays.asList("type", "value");
54  }
55  }
56 
57  public static class UnionOpInfo extends Capstone.UnionOpInfo {
58  public int cc;
59  public byte op_count;
60 
61  public Operand [] op;
62 
63  public UnionOpInfo() {
64  op = new Operand[6];
65  }
66 
67  public void read() {
68  readField("cc");
69  readField("op_count");
70  op = new Operand[op_count];
71  if (op_count != 0)
72  readField("op");
73  }
74 
75  @Override
76  public List getFieldOrder() {
77  return Arrays.asList("cc", "op_count", "op");
78  }
79  }
80 
81  public static class OpInfo extends Capstone.OpInfo {
82  public int cc;
83 
84  public Operand [] op;
85 
86  public OpInfo(UnionOpInfo op_info) {
87  cc = op_info.cc;
88  op = op_info.op;
89  }
90  }
91 }
@ SYSZ_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: systemz.h:42
@ SYSZ_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: systemz.h:41
@ SYSZ_OP_ACREG
Access register operand.
Definition: systemz.h:43
@ SYSZ_OP_INVALID
= CS_OP_INVALID (Uninitialized).
Definition: systemz.h:39
@ SYSZ_OP_REG
= CS_OP_REG (Register operand).
Definition: systemz.h:40
OpInfo(UnionOpInfo op_info)
Definition: Systemz.java:86
Definition: Arm.java:4
Definition: dis.c:32