i386: Check vector length for EVEX vextractfXX and vinsertfXX
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 5 Jun 2019 17:27:08 +0000 (10:27 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 5 Jun 2019 17:27:28 +0000 (10:27 -0700)
Since not all vector lengths are supported by EVEX vextractfXX and
vinsertfXX, decode them only with supported vector lengths.

gas/

PR binutils/24633
* testsuite/gas/i386/disassem.s: Add tests for invalid vector
lengths for EVEX vextractfXX and vinsertfXX.
* testsuite/gas/i386/x86-64-disassem.s: Likewise.
* testsuite/gas/i386/disassem.d: Updated.
* testsuite/gas/i386/x86-64-disassem.d: Likewise.

opcodes/

PR binutils/24633
* i386-dis-evex.h (evex_table): Update EVEX_W_0F3A18_P_2,
EVEX_W_0F3A19_P_2, EVEX_W_0F3A1A_P_2 and EVEX_W_0F3A1B_P_2.
(evex_len_table): EVEX_LEN_0F3A18_P_2_W_0,
EVEX_LEN_0F3A18_P_2_W_1, EVEX_LEN_0F3A19_P_2_W_0,
EVEX_LEN_0F3A19_P_2_W_1, EVEX_LEN_0F3A1A_P_2_W_0,
EVEX_LEN_0F3A1A_P_2_W_1, EVEX_LEN_0F3A1B_P_2_W_0,
EVEX_LEN_0F3A1B_P_2_W_1.
* i386-dis.c (EVEX_LEN_0F3A18_P_2_W_0): New enum.
(EVEX_LEN_0F3A18_P_2_W_1): Likewise.
(EVEX_LEN_0F3A19_P_2_W_0): Likewise.
(EVEX_LEN_0F3A19_P_2_W_1): Likewise.
(EVEX_LEN_0F3A1A_P_2_W_0): Likewise.
(EVEX_LEN_0F3A1A_P_2_W_1): Likewise.
(EVEX_LEN_0F3A1B_P_2_W_0): Likewise.
(EVEX_LEN_0F3A1B_P_2_W_1): Likewise.

gas/ChangeLog
gas/testsuite/gas/i386/disassem.d
gas/testsuite/gas/i386/disassem.s
gas/testsuite/gas/i386/x86-64-disassem.d
gas/testsuite/gas/i386/x86-64-disassem.s
opcodes/ChangeLog
opcodes/i386-dis-evex.h
opcodes/i386-dis.c

index 036d734dd98ede86566f04845559a4d93a906d71..88bba08df895515a27d7cedc92be1c78083d1c4d 100644 (file)
@@ -1,3 +1,12 @@
+2019-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/24633
+       * testsuite/gas/i386/disassem.s: Add tests for invalid vector
+       lengths for EVEX vextractfXX and vinsertfXX.
+       * testsuite/gas/i386/x86-64-disassem.s: Likewise.
+       * testsuite/gas/i386/disassem.d: Updated.
+       * testsuite/gas/i386/x86-64-disassem.d: Likewise.
+
 2019-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/24626
index ff9ee497e32224a1ecea7bcc6c77c2951055ff1d..530e3a17d560941cc4aebb33c12087325fd64676 100644 (file)
@@ -345,5 +345,8 @@ Disassembly of section \.text:
 [      ]*[a-f0-9]+:[   ]*41[   ]*inc[  ]*%ecx
 [      ]*[a-f0-9]+:[   ]*37[   ]*aaa[ ]*
 [      ]*[a-f0-9]+:[   ]*62 f2 ad 08 1c[       ]*\(bad\)[ ]*
-[      ]*[a-f0-9]+:[   ]*01[   ]*.byte[        ]*0x1
+[      ]*[a-f0-9]+:[   ]*01 01[        ]*add[  ]*%eax,\(%ecx\)
+[      ]*[a-f0-9]+:[   ]*62 f3 7d 28 1b[       ]*\(bad\)[ ]*
+[      ]*[a-f0-9]+:[   ]*c8[   ]*.byte[        ]*0xc8
+[      ]*[a-f0-9]+:[   ]*25[   ]*.byte[        ]*0x25
 #pass
index 700208aa356f8cd03b6eb0d30f79e618e88d8cd7..00eeb396d4e33296b96ef4133729f2e946834b9e 100644 (file)
 .byte 0xC4, 0xE1, 0xF9, 0x93, 0x3F
 .byte 0xc4, 0xe2, 0x1, 0x1c, 0x41, 0x37
 .byte 0x62, 0xf2, 0xad, 0x08, 0x1c, 0x01
+.byte 0x1
+.byte 0x62, 0xf3, 0x7d, 0x28, 0x1b, 0xc8, 0x25
index c8277bf0eba724132b489b9a6853310ec858d475..a7c2c3ec964c853cd3e9828dc8df73a908fa839d 100644 (file)
@@ -344,5 +344,8 @@ Disassembly of section \.text:
 [      ]*[a-f0-9]+:[   ]*c4 62 01 1c[  ]*\(bad\)[ ]*
 [      ]*[a-f0-9]+:[   ]*41 37[        ]*rex.B \(bad\)[ ]*
 [      ]*[a-f0-9]+:[   ]*62 72 ad 08 1c[       ]*\(bad\)[ ]*
-[      ]*[a-f0-9]+:[   ]*01[   ]*.byte[        ]*0x1
+[      ]*[a-f0-9]+:[   ]*01 01[        ]*add[  ]*%eax,\(%rcx\)
+[      ]*[a-f0-9]+:[   ]*62 f3 7d 28 1b[       ]*\(bad\)[ ]*
+[      ]*[a-f0-9]+:[   ]*c8[   ]*.byte[        ]*0xc8
+[      ]*[a-f0-9]+:[   ]*25[   ]*.byte[        ]*0x25
 #pass
index ade5e15c1db654670fcaa56eaf695e8d774955d3..ef4e87d14c1d2fc4cd4d6400601af13a34a63989 100644 (file)
 .byte 0xC4, 0xE1, 0xF9, 0x93, 0x3F
 .byte 0xc4, 0x62, 0x1, 0x1c, 0x41, 0x37
 .byte 0x62, 0x72, 0xad, 0x08, 0x1c, 0x01
+.byte 0x1
+.byte 0x62, 0xf3, 0x7d, 0x28, 0x1b, 0xc8, 0x25
index 9f5b347c68fcea45b76585eb675174259010aadb..8d72ded6721f4cad9e80f42a45bf9f36d7760fe6 100644 (file)
@@ -1,3 +1,22 @@
+2019-06-05  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/24633
+       * i386-dis-evex.h (evex_table): Update EVEX_W_0F3A18_P_2,
+       EVEX_W_0F3A19_P_2, EVEX_W_0F3A1A_P_2 and EVEX_W_0F3A1B_P_2.
+       (evex_len_table): EVEX_LEN_0F3A18_P_2_W_0,
+       EVEX_LEN_0F3A18_P_2_W_1, EVEX_LEN_0F3A19_P_2_W_0,
+       EVEX_LEN_0F3A19_P_2_W_1, EVEX_LEN_0F3A1A_P_2_W_0,
+       EVEX_LEN_0F3A1A_P_2_W_1, EVEX_LEN_0F3A1B_P_2_W_0,
+       EVEX_LEN_0F3A1B_P_2_W_1.
+       * i386-dis.c (EVEX_LEN_0F3A18_P_2_W_0): New enum.
+       (EVEX_LEN_0F3A18_P_2_W_1): Likewise.
+       (EVEX_LEN_0F3A19_P_2_W_0): Likewise.
+       (EVEX_LEN_0F3A19_P_2_W_1): Likewise.
+       (EVEX_LEN_0F3A1A_P_2_W_0): Likewise.
+       (EVEX_LEN_0F3A1A_P_2_W_1): Likewise.
+       (EVEX_LEN_0F3A1B_P_2_W_0): Likewise.
+       (EVEX_LEN_0F3A1B_P_2_W_1): Likewise.
+
 2019-06-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/24626
index 9965d4f9fff60a34701960862a9c04da6b4f8e52..0003e7791de6dc11caea719a1b4b803a67ccecde 100644 (file)
@@ -3912,23 +3912,23 @@ static const struct dis386 evex_table[][256] = {
   },
   /* EVEX_W_0F3A18_P_2 */
   {
-    { "vinsertf32x4",  { XM, Vex, EXxmm, Ib }, 0 },
-    { "vinsertf64x2",  { XM, Vex, EXxmm, Ib }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A18_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A18_P_2_W_1) },
   },
   /* EVEX_W_0F3A19_P_2 */
   {
-    { "vextractf32x4", { EXxmm, XM, Ib }, 0 },
-    { "vextractf64x2", { EXxmm, XM, Ib }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A19_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A19_P_2_W_1) },
   },
   /* EVEX_W_0F3A1A_P_2 */
   {
-    { "vinsertf32x8",  { XM, Vex, EXxmmq, Ib }, 0 },
-    { "vinsertf64x4",  { XM, Vex, EXxmmq, Ib }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A1A_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A1A_P_2_W_1) },
   },
   /* EVEX_W_0F3A1B_P_2 */
   {
-    { "vextractf32x8", { EXxmmq, XM, Ib }, 0 },
-    { "vextractf64x4", { EXxmmq, XM, Ib }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A1B_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3A1B_P_2_W_1) },
   },
   /* EVEX_W_0F3A1D_P_2 */
   {
@@ -4129,4 +4129,60 @@ static const struct dis386 evex_table[][256] = {
     { VEX_W_TABLE (EVEX_W_0FD6_P_2) },
   },
 
+  /* EVEX_LEN_0F3A18_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { "vinsertf32x4",  { XM, Vex, EXxmm, Ib }, 0 },
+    { "vinsertf32x4",  { XM, Vex, EXxmm, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A18_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { "vinsertf64x2",  { XM, Vex, EXxmm, Ib }, 0 },
+    { "vinsertf64x2",  { XM, Vex, EXxmm, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A19_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { "vextractf32x4", { EXxmm, XM, Ib }, 0 },
+    { "vextractf32x4", { EXxmm, XM, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A19_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { "vextractf64x2", { EXxmm, XM, Ib }, 0 },
+    { "vextractf64x2", { EXxmm, XM, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A1A_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vinsertf32x8",  { XM, Vex, EXxmmq, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A1A_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vinsertf64x4",  { XM, Vex, EXxmmq, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A1B_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vextractf32x8", { EXxmmq, XM, Ib }, 0 },
+  },
+
+  /* EVEX_LEN_0F3A1B_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vextractf64x4", { EXxmmq, XM, Ib }, 0 },
+  },
+
 #endif /* NEED_EVEX_LEN_TABLE */
index f5975398328d13037edd24b1c5174843a347ed85..5d1bd6b0300ac0769f32acab537fc1c310232c54 100644 (file)
@@ -1937,7 +1937,15 @@ enum
   EVEX_LEN_0F6E_P_2 = 0,
   EVEX_LEN_0F7E_P_1,
   EVEX_LEN_0F7E_P_2,
-  EVEX_LEN_0FD6_P_2
+  EVEX_LEN_0FD6_P_2,
+  EVEX_LEN_0F3A18_P_2_W_0,
+  EVEX_LEN_0F3A18_P_2_W_1,
+  EVEX_LEN_0F3A19_P_2_W_0,
+  EVEX_LEN_0F3A19_P_2_W_1,
+  EVEX_LEN_0F3A1A_P_2_W_0,
+  EVEX_LEN_0F3A1A_P_2_W_1,
+  EVEX_LEN_0F3A1B_P_2_W_0,
+  EVEX_LEN_0F3A1B_P_2_W_1
 };
 
 enum
This page took 0.031517 seconds and 4 git commands to generate.