]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
i386: Check vector length for EVEX broadcast instructions
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 19 Jun 2019 17:01:27 +0000 (10:01 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 19 Jun 2019 17:01:42 +0000 (10:01 -0700)
Since not all vector lengths are supported by EVEX broadcast instructions,
decode them only with supported vector lengths.

gas/

PR binutils/24700
* testsuite/gas/i386/disassem.s: Add test for vbroadcasti32x8
with invalid vector length.
* 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/24700
* i386-dis-evex.h (evex_table): Update EVEX_W_0F3819_P_2,
EVEX_W_0F381A_P_2, EVEX_W_0F381B_P_2, EVEX_W_0F385A_P_2 and
EVEX_W_0F385B_P_2.
(evex_len_table): Add EVEX_LEN_0F3819_P_2_W_0,
EVEX_LEN_0F3819_P_2_W_1, EVEX_LEN_0F381A_P_2_W_0,
EVEX_LEN_0F381A_P_2_W_1, EVEX_LEN_0F381B_P_2_W_0,
EVEX_LEN_0F381B_P_2_W_1, EVEX_LEN_0F385A_P_2_W_0,
EVEX_LEN_0F385A_P_2_W_1, EVEX_LEN_0F385B_P_2_W_0 and
EVEX_LEN_0F385B_P_2_W_1.
* i386-dis.c (EVEX_LEN_0F3819_P_2_W_0): New enum.
(EVEX_LEN_0F3819_P_2_W_1): Likewise.
(EVEX_LEN_0F381A_P_2_W_0): Likewise.
(EVEX_LEN_0F381A_P_2_W_1): Likewise.
(EVEX_LEN_0F381B_P_2_W_0): Likewise.
(EVEX_LEN_0F381B_P_2_W_1): Likewise.
(EVEX_LEN_0F385A_P_2_W_0): Likewise.
(EVEX_LEN_0F385A_P_2_W_1): Likewise.
(EVEX_LEN_0F385B_P_2_W_0): Likewise.
(EVEX_LEN_0F385B_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 c7ed06e6d00b2d0bd00270d18676fec44dc483da..1e9cf0b6b87acd0c36fbe6e9d91b788ff68773d8 100644 (file)
@@ -1,3 +1,12 @@
+2019-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/24700
+       * testsuite/gas/i386/disassem.s: Add test for vbroadcasti32x8
+       with invalid vector length.
+       * testsuite/gas/i386/x86-64-disassem.s: Likewise.
+       * testsuite/gas/i386/disassem.d: Updated.
+       * testsuite/gas/i386/x86-64-disassem.d: Likewise.
+
 2019-06-17  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/24691
index 27f37b6e2f743c2cb75160a8880c467285f208ee..9a805a4907527da9e1ecfa0e41b46cfac12af2df 100644 (file)
@@ -349,6 +349,8 @@ Disassembly of section \.text:
 [      ]*[a-f0-9]+:[   ]*62 f3 7d 28 1b[       ]*\(bad\)[ ]*
 [      ]*[a-f0-9]+:[   ]*c8 25 62 f3[  ]*enter[ ]*\$0x6225,\$0xf3
 [      ]*[a-f0-9]+:[   ]*62 f3 75 08 23[       ]*\(bad\)[ ]*
-[      ]*[a-f0-9]+:[   ]*c2[   ]*.byte[        ]*0xc2
-[      ]*[a-f0-9]+:[   ]*25[   ]*.byte[        ]*0x25
+[      ]*[a-f0-9]+:[   ]*c2 25 62[     ]*ret[ ]*\$0x6225
+[      ]*[a-f0-9]+:[   ]*62 f2 7d 28 5b[       ]*\(bad\)[ ]*
+[      ]*[a-f0-9]+:[   ]*41[   ]*inc[  ]*%ecx
+[      ]*[a-f0-9]+:[   ]*37[   ]*aaa[ ]*
 #pass
index d33001875623e9e502e79471cdfcda7ee73e66d8..9a4aa5ad6e7a83f08ee98f0d1d4c109e81022cd8 100644 (file)
 .byte 0x62, 0xf3, 0x7d, 0x28, 0x1b, 0xc8, 0x25
 .byte 0x62, 0xf3
 .byte 0x62, 0xf3, 0x75, 0x08, 0x23, 0xc2, 0x25
+.byte 0x62
+.byte 0x62, 0xf2, 0x7d, 0x28, 0x5b, 0x41, 0x37
index 3dcbc104eb52377eab729a078f5b2d0b6c85852c..62b8c44c90f17ea40be79b6555e10bf69538e2f3 100644 (file)
@@ -348,6 +348,7 @@ Disassembly of section \.text:
 [      ]*[a-f0-9]+:[   ]*62 f3 7d 28 1b[       ]*\(bad\)[ ]*
 [      ]*[a-f0-9]+:[   ]*c8 25 62 f3[  ]*enterq[ ]*\$0x6225,\$0xf3
 [      ]*[a-f0-9]+:[   ]*62 f3 75 08 23[       ]*\(bad\)[ ]*
-[      ]*[a-f0-9]+:[   ]*c2[   ]*.byte[        ]*0xc2
-[      ]*[a-f0-9]+:[   ]*25[   ]*.byte[        ]*0x25
+[      ]*[a-f0-9]+:[   ]*c2 25 62[     ]*retq[ ]*\$0x6225
+[      ]*[a-f0-9]+:[   ]*62 f2 7d 28 5b[       ]*\(bad\)[ ]*
+[      ]*[a-f0-9]+:[   ]*41 37[        ]*rex.B \(bad\)[ ]*
 #pass
index 7535052760cd0902ad16dd8d11328245bdbc42ee..7184e3f8252c4e26c356478e6fe50ae1ca53811a 100644 (file)
 .byte 0x62, 0xf3, 0x7d, 0x28, 0x1b, 0xc8, 0x25
 .byte 0x62, 0xf3
 .byte 0x62, 0xf3, 0x75, 0x08, 0x23, 0xc2, 0x25
+.byte 0x62
+.byte 0x62, 0xf2, 0x7d, 0x28, 0x5b, 0x41, 0x37
index b76a899860d3a98c75ead62ae96ff07303a56876..92a42efc893bba1aa28d1b6bc60cfca4a7b3e412 100644 (file)
@@ -1,3 +1,26 @@
+2019-06-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/24700
+       * i386-dis-evex.h (evex_table): Update EVEX_W_0F3819_P_2,
+       EVEX_W_0F381A_P_2, EVEX_W_0F381B_P_2, EVEX_W_0F385A_P_2 and
+       EVEX_W_0F385B_P_2.
+       (evex_len_table): Add EVEX_LEN_0F3819_P_2_W_0,
+       EVEX_LEN_0F3819_P_2_W_1, EVEX_LEN_0F381A_P_2_W_0,
+       EVEX_LEN_0F381A_P_2_W_1, EVEX_LEN_0F381B_P_2_W_0,
+       EVEX_LEN_0F381B_P_2_W_1, EVEX_LEN_0F385A_P_2_W_0,
+       EVEX_LEN_0F385A_P_2_W_1, EVEX_LEN_0F385B_P_2_W_0 and
+       EVEX_LEN_0F385B_P_2_W_1.
+       * i386-dis.c (EVEX_LEN_0F3819_P_2_W_0): New enum.
+       (EVEX_LEN_0F3819_P_2_W_1): Likewise.
+       (EVEX_LEN_0F381A_P_2_W_0): Likewise.
+       (EVEX_LEN_0F381A_P_2_W_1): Likewise.
+       (EVEX_LEN_0F381B_P_2_W_0): Likewise.
+       (EVEX_LEN_0F381B_P_2_W_1): Likewise.
+       (EVEX_LEN_0F385A_P_2_W_0): Likewise.
+       (EVEX_LEN_0F385A_P_2_W_1): Likewise.
+       (EVEX_LEN_0F385B_P_2_W_0): Likewise.
+       (EVEX_LEN_0F385B_P_2_W_1): Likewise.
+
 2019-06-17  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/24691
index f34f8bc1a1254c52c7e668dcf743edb8021e58b5..e9a9d923bfb36ad7959f61dfae44de9cba4e463b 100644 (file)
@@ -3568,18 +3568,18 @@ static const struct dis386 evex_table[][256] = {
   },
   /* EVEX_W_0F3819_P_2 */
   {
-    { "vbroadcastf32x2",       { XM, EXxmm_mq }, 0 },
-    { "vbroadcastsd",  { XM, EXxmm_mq }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3819_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F3819_P_2_W_1) },
   },
   /* EVEX_W_0F381A_P_2 */
   {
-    { "vbroadcastf32x4",       { XM, EXxmm }, 0 },
-    { "vbroadcastf64x2",       { XM, EXxmm }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F381A_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F381A_P_2_W_1) },
   },
   /* EVEX_W_0F381B_P_2 */
   {
-    { "vbroadcastf32x8",       { XM, EXxmmq }, 0 },
-    { "vbroadcastf64x4",       { XM, EXymm }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F381B_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F381B_P_2_W_1) },
   },
   /* EVEX_W_0F381E_P_2 */
   {
@@ -3739,13 +3739,13 @@ static const struct dis386 evex_table[][256] = {
   },
   /* EVEX_W_0F385A_P_2 */
   {
-    { "vbroadcasti32x4",       { XM, EXxmm }, 0 },
-    { "vbroadcasti64x2",       { XM, EXxmm }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F385A_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F385A_P_2_W_1) },
   },
   /* EVEX_W_0F385B_P_2 */
   {
-    { "vbroadcasti32x8",       { XM, EXxmmq }, 0 },
-    { "vbroadcasti64x4",       { XM, EXymm }, 0 },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F385B_P_2_W_0) },
+    { EVEX_LEN_TABLE (EVEX_LEN_0F385B_P_2_W_1) },
   },
   /* EVEX_W_0F3862_P_2 */
   {
@@ -4129,6 +4129,76 @@ static const struct dis386 evex_table[][256] = {
     { VEX_W_TABLE (EVEX_W_0FD6_P_2) },
   },
 
+  /* EVEX_LEN_0F3819_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { "vbroadcastf32x2",       { XM, EXxmm_mq }, 0 },
+    { "vbroadcastf32x2",       { XM, EXxmm_mq }, 0 },
+  },
+
+  /* EVEX_LEN_0F3819_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { "vbroadcastsd",  { XM, EXxmm_mq }, 0 },
+    { "vbroadcastsd",  { XM, EXxmm_mq }, 0 },
+  },
+
+  /* EVEX_LEN_0F381A_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { "vbroadcastf32x4",       { XM, EXxmm }, 0 },
+    { "vbroadcastf32x4",       { XM, EXxmm }, 0 },
+  },
+
+  /* EVEX_LEN_0F381A_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { "vbroadcastf64x2",       { XM, EXxmm }, 0 },
+    { "vbroadcastf64x2",       { XM, EXxmm }, 0 },
+  },
+
+  /* EVEX_LEN_0F381B_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vbroadcastf32x8",       { XM, EXxmmq }, 0 },
+  },
+
+  /* EVEX_LEN_0F381B_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vbroadcastf64x4",       { XM, EXymm }, 0 },
+  },
+
+  /* EVEX_LEN_0F385A_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { "vbroadcasti32x4",       { XM, EXxmm }, 0 },
+    { "vbroadcasti32x4",       { XM, EXxmm }, 0 },
+  },
+
+  /* EVEX_LEN_0F385A_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { "vbroadcasti64x2",       { XM, EXxmm }, 0 },
+    { "vbroadcasti64x2",       { XM, EXxmm }, 0 },
+  },
+
+  /* EVEX_LEN_0F385B_P_2_W_0 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vbroadcasti32x8",       { XM, EXxmmq }, 0 },
+  },
+
+  /* EVEX_LEN_0F385B_P_2_W_1 */
+  {
+    { Bad_Opcode },
+    { Bad_Opcode },
+    { "vbroadcasti64x4",       { XM, EXymm }, 0 },
+  },
+
   /* EVEX_LEN_0F3A18_P_2_W_0 */
   {
     { Bad_Opcode },
index 496b8f26a8c6fbb8f1b845ac929c44fbd1e9f7c5..c765c849e5ee38a579b1dd47a6e57cba2e32fee2 100644 (file)
@@ -1938,6 +1938,16 @@ enum
   EVEX_LEN_0F7E_P_1,
   EVEX_LEN_0F7E_P_2,
   EVEX_LEN_0FD6_P_2,
+  EVEX_LEN_0F3819_P_2_W_0,
+  EVEX_LEN_0F3819_P_2_W_1,
+  EVEX_LEN_0F381A_P_2_W_0,
+  EVEX_LEN_0F381A_P_2_W_1,
+  EVEX_LEN_0F381B_P_2_W_0,
+  EVEX_LEN_0F381B_P_2_W_1,
+  EVEX_LEN_0F385A_P_2_W_0,
+  EVEX_LEN_0F385A_P_2_W_1,
+  EVEX_LEN_0F385B_P_2_W_0,
+  EVEX_LEN_0F385B_P_2_W_1,
   EVEX_LEN_0F3A18_P_2_W_0,
   EVEX_LEN_0F3A18_P_2_W_1,
   EVEX_LEN_0F3A19_P_2_W_0,