]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
x86/APX: Add invalid check for APX EVEX.X4.
authorCui, Lili <lili.cui@intel.com>
Mon, 22 Apr 2024 01:25:56 +0000 (09:25 +0800)
committerCui, Lili <lili.cui@intel.com>
Mon, 22 Apr 2024 01:25:56 +0000 (09:25 +0800)
gas/ChangeLog:

        * config/tc-i386.c (build_apx_evex_prefix): Added invalid check for APX
        X4.
        * testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: Added invalid
        testcase.
        * testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: Ditto.

opcodes/ChangeLog:

        * i386-dis.c (get_valid_dis386): Added invalid check for APX X4.

gas/config/tc-i386.c
gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d
gas/testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s
opcodes/i386-dis.c

index 1637f55759c04ca528998fed2b2a732bff8e640c..b03746852d6036564b19e3b003914e92064833ef 100644 (file)
@@ -4276,7 +4276,10 @@ build_apx_evex_prefix (void)
   if (i.rex2 & REX_B)
     i.vex.bytes[1] |= 0x08;
   if (i.rex2 & REX_X)
-    i.vex.bytes[2] &= ~0x04;
+    {
+      gas_assert (i.rm.mode != 3);
+      i.vex.bytes[2] &= ~0x04;
+    }
   if (i.vex.register_specifier
       && i.vex.register_specifier->reg_flags & RegRex2)
     i.vex.bytes[3] &= ~0x08;
index 1a6b6656ff72fa0c3d36664989b63cce9a4f4f70..6330367194cb0c24e7e5f289b1cbb871e0a2b3d2 100644 (file)
@@ -39,4 +39,6 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:[   ]+62 d4 24 18 8f[       ]+\(bad\)
 [      ]*[a-f0-9]+:[   ]+c3[   ]+.*
 [      ]*[a-f0-9]+:[   ]+62 fc 7d 0c 60 c7[    ]+movbe  \{bad-nf\},%r23w,%ax
+[      ]*[a-f0-9]+:[   ]+62 fc 79 08 60[       ]+\(bad\)
+[      ]*[a-f0-9]+:[   ]+c2[   ]+.*
 #pass
index bc55b5e726afcb9e668e159adcdbc267e5e1cc90..cbf34515bab04de6c45d0e5bdfe302cce51e9aeb 100644 (file)
@@ -53,3 +53,6 @@ _start:
 
        #EVEX_MAP4 movbe %r18w,%ax set EVEX.nf = 1.
        .insn EVEX.L0.66.M12.W0 0x60, %di, %ax {%k4}
+
+       # EVEX_MAP4 movbe %r18w,%ax set EVEX.P[10] = 0.
+       .byte 0x62, 0xfc, 0x79, 0x08, 0x60, 0xc2
index b9fdda1b578f278a6c321446be9d6ea15e526d7f..53f2d6cf6d8c00c66accdd6c2b9b0b51e7cc7127 100644 (file)
@@ -9192,6 +9192,9 @@ get_valid_dis386 (const struct dis386 *dp, instr_info *ins)
       if (!fetch_modrm (ins))
        return &err_opcode;
 
+      if (ins->modrm.mod == 3 && (ins->rex2 & REX_X))
+       return &bad_opcode;
+
       /* Set vector length. For EVEX-promoted instructions, evex.ll == 0b00,
         which has the same encoding as vex.length == 128 and they can share
         the same processing with vex.length in OP_VEX.  */