x86: add AVX's zero_opmask to cs_x86_op struct. updated Python & Java bindings for this change
diff --git a/arch/X86/X86GenAsmWriter.inc b/arch/X86/X86GenAsmWriter.inc
index 5f8253d..92c814c 100644
--- a/arch/X86/X86GenAsmWriter.inc
+++ b/arch/X86/X86GenAsmWriter.inc
@@ -13570,11 +13570,13 @@
case 5:
// VMOVDQU32rrkz, VMOVDQU64rrkz
SStream_concat0(O, "} {z}");
+ op_addZeroOpmask(MI);
return;
break;
case 6:
// VPBROADCASTDZkrm, VPBROADCASTDZkrr, VPBROADCASTDrZkrr, VPBROADCASTQZkr...
SStream_concat0(O, "} {z}");
+ op_addZeroOpmask(MI);
return;
break;
case 7:
diff --git a/arch/X86/X86GenAsmWriter1.inc b/arch/X86/X86GenAsmWriter1.inc
index 51fb4b4..eccbfb9 100644
--- a/arch/X86/X86GenAsmWriter1.inc
+++ b/arch/X86/X86GenAsmWriter1.inc
@@ -12838,6 +12838,7 @@
case 8:
// VMOVDQU32rrkz, VMOVDQU64rrkz, VPBROADCASTDZkrm, VPBROADCASTDZkrr, VPBR...
SStream_concat0(O, "} {z}, ");
+ op_addZeroOpmask(MI);
break;
case 9:
// VPCONFLICTDrmb
diff --git a/arch/X86/X86Mapping.c b/arch/X86/X86Mapping.c
index 25f8830..a0cf886 100644
--- a/arch/X86/X86Mapping.c
+++ b/arch/X86/X86Mapping.c
@@ -42600,4 +42600,12 @@
}
}
+void op_addZeroOpmask(MCInst *MI)
+{
+ if (MI->csh->detail) {
+ // link with the previous operand
+ MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count - 1].zero_opmask = true;
+ }
+}
+
#endif
diff --git a/arch/X86/X86Mapping.h b/arch/X86/X86Mapping.h
index 9b25235..1e577bb 100644
--- a/arch/X86/X86Mapping.h
+++ b/arch/X86/X86Mapping.h
@@ -52,4 +52,6 @@
void op_addSseCC(MCInst *MI, int v);
void op_addAvxCC(MCInst *MI, int v);
+void op_addZeroOpmask(MCInst *MI);
+
#endif
diff --git a/bindings/java/TestX86.java b/bindings/java/TestX86.java
index 27f5038..89811b6 100644
--- a/bindings/java/TestX86.java
+++ b/bindings/java/TestX86.java
@@ -115,6 +115,11 @@
System.out.printf("\t\toperands[%d].avx_bcast: %d\n", c, i.avx_bcast);
}
+ // AVX zero opmask {z}
+ if (i.zero_opmask) {
+ System.out.printf("\t\toperands[%d].zero_opmask: TRUE\n", c);
+ }
+
System.out.printf("\t\toperands[%d].size: %d\n", c, i.size);
}
}
diff --git a/bindings/java/capstone/X86.java b/bindings/java/capstone/X86.java
index b705f45..74d5f39 100644
--- a/bindings/java/capstone/X86.java
+++ b/bindings/java/capstone/X86.java
@@ -43,6 +43,7 @@
public OpValue value;
public int size;
public int avx_bcast;
+ public boolean zero_opmask;
public void read() {
super.read();
@@ -61,7 +62,7 @@
@Override
public List getFieldOrder() {
- return Arrays.asList("type", "value", "size", "avx_bcast");
+ return Arrays.asList("type", "value", "size", "avx_bcast", "zero_opmask");
}
}
diff --git a/bindings/python/capstone/x86.py b/bindings/python/capstone/x86.py
index f19add3..9616aa3 100644
--- a/bindings/python/capstone/x86.py
+++ b/bindings/python/capstone/x86.py
@@ -27,6 +27,7 @@
('value', X86OpValue),
('size', ctypes.c_uint8),
('avx_bcast', ctypes.c_uint),
+ ('zero_opmask', ctypes.c_uint8),
)
@property
diff --git a/bindings/python/test_x86.py b/bindings/python/test_x86.py
index ff2da41..072834f 100755
--- a/bindings/python/test_x86.py
+++ b/bindings/python/test_x86.py
@@ -103,6 +103,10 @@
if i.avx_bcast != X86_AVX_BCAST_INVALID:
print("\t\toperands[%u].avx_bcast: %u" % (c, i.avx_bcast))
+ # AVX zero opmask {z}
+ if i.zero_opmask:
+ print("\t\toperands[%u].zero_opmask: TRUE" % (c))
+
print("\t\toperands[%u].size: %u" % (c, i.size))
diff --git a/include/x86.h b/include/x86.h
index 144b6cc..1bf03e4 100644
--- a/include/x86.h
+++ b/include/x86.h
@@ -167,6 +167,9 @@
// AVX broadcast type, or 0 if irrelevant
x86_avx_bcast avx_bcast;
+
+ // AVX zero opmask {z}
+ bool zero_opmask;
} cs_x86_op;
// Instruction structure
diff --git a/tests/test_x86.c b/tests/test_x86.c
index 6a4cf68..b1c53fe 100644
--- a/tests/test_x86.c
+++ b/tests/test_x86.c
@@ -109,10 +109,14 @@
break;
}
- // the size is irrelevant for X86_OP_IMM
+ // AVX broadcast type
if (op->avx_bcast != X86_AVX_BCAST_INVALID)
printf("\t\toperands[%u].avx_bcast: %u\n", i, op->avx_bcast);
+ // AVX zero opmask {z}
+ if (op->zero_opmask != false)
+ printf("\t\toperands[%u].zero_opmask: TRUE\n", i);
+
printf("\t\toperands[%u].size: %u\n", i, op->size);
}