[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 27/30] x86emul: support APX+MOVRS insn


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 11 Nov 2026 15:31:28 +0100
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:Content-Language:References:Cc:To:From:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • Delivery-date: Wed, 11 Nov 2026 14:31:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Besides adding table entries and case labels there's once again very
little to do here; generic map 4 handling takes care of things.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
SDE: -dmr

--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -1181,6 +1181,12 @@ static const struct test movdiri[] = {
     INSN(movdiri,     , map4, f9,    el,   dq, no),
 };
 
+static const struct test movrs[] = {
+    INSN(movrs,       , map4, 8a,    el,    b, no),
+    INSN(movrs,       , map4, 8b,    el,   dq, no),
+    INSN(movrsw,    66, map4, 8b,    el,    w, no),
+};
+
 static const struct test popcnt[] = {
     INSN(popcnt,      , map4, 88,    el,   dq, no),
     INSN(popcntw,   66, map4, 88,    el,    w, no),
@@ -1801,6 +1807,7 @@ void evex_disp8_test(void *instr, struct
         RUN(movbe);
         RUN(movdir64b);
         RUN(movdiri);
+        RUN(movrs);
         RUN(popcnt);
 
 #undef RUN
--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -2266,6 +2266,9 @@ static const struct evex {
     { { 0x85 }, 2, T, R, pfx_66, Wn, L0, SCC }, /* ctest<scc> */
     { { 0x88 }, 2, T, R, pfx_no, Wn, L0 }, /* popcnt */
     { { 0x88 }, 2, T, R, pfx_66, Wn, L0 }, /* popcnt */
+    { { 0x8a }, 2, T, R, pfx_no, WIG, L0 }, /* movrs */
+    { { 0x8b }, 2, T, R, pfx_no, Wn, L0 }, /* movrs */
+    { { 0x8b }, 2, T, R, pfx_66, Wn, L0 }, /* movrs */
     { { 0x8f, 0xc0 }, 2, F, R, pfx_no, Wn, L0, ND }, /* pop2 */
     { { 0xa5 }, 2, T, W, pfx_no, Wn, L0, ND }, /* shld */
     { { 0xa5 }, 2, T, W, pfx_66, Wn, L0, ND }, /* shld */
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -2356,6 +2356,22 @@ int main(int argc, char **argv)
             goto fail;
         printf("okay\n");
 
+        if ( cpu_has_apx_f )
+        {
+            printf("%-40s", "Testing movrs 6(%r31),%r30w...");
+            instr[0] = 0x62; instr[1] = 0x4c; instr[2] = 0x7d; instr[3] = 0x08;
+            instr[4] = 0x8b; instr[5] = 0x77; instr[6] = 0x06;
+            regs.rip = (unsigned long)&instr[0];
+            load_egpr(30, 0x8888777766665555UL);
+            load_egpr(31, (unsigned long)res);
+            rc = x86_emulate(&ctxt, &emulops);
+            if ( (rc != X86EMUL_OKAY) ||
+                 (regs.rip != (unsigned long)&instr[7]) ||
+                 !check_egpr(30, 0x8888777766668877UL) )
+                goto fail;
+            printf("okay\n");
+        }
+
         cpu_policy.feat.movrs = movrs;
     }
 
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -738,6 +738,13 @@ static const struct map4_table {
         [vex_np] = { },
         [vex_66] = { },
     },
+    [0x8a] = { /* MOVRS (byte) */
+        [vex_np] = { .byte = true },
+    },
+    [0x8b] = { /* MOVRS ({,d,q}word) */
+        [vex_np] = { },
+        [vex_66] = { },
+    },
     [0x88] = { /* POPCNT ({,d,q}word) */
         [vex_np] = { .nf = true, .nci_ndd_nf = true },
         [vex_66] = { .nf = true, .nci_ndd_nf = true },
@@ -1420,6 +1427,11 @@ decode_map4(struct x86_emulate_state *s,
         nf = map4_table[(s->modrm_reg & 7) << 3][s->evex.pfx].nf;
         break;
 
+    case 0x8a: case 0x8b: /* movrs */
+    case 0xf9: /* movdiri */
+        s->desc |= Mov;
+        break;
+
     case 0xc0: case 0xc1: case 0xd0 ... 0xd3: /* Grp2 */
         /* rcl/rcr do not allow EVEX.nf to be set. */
         nf = (s->modrm_reg & 6) != 2;
@@ -1463,10 +1475,6 @@ decode_map4(struct x86_emulate_state *s,
         s->op_bytes = 0;
         break;
 
-    case 0xf9: /* movdiri */
-        s->desc |= Mov;
-        break;
-
     case 0xff: /* Grp5 */
         switch ( s->modrm_reg & 7 )
         {
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6807,6 +6807,9 @@ x86_emulate(
 
     case X86EMUL_OPC(0x0f38, 0x8a)
      ... X86EMUL_OPC(0x0f38, 0x8b): /* movrs */
+    case X86EMUL_OPC_EVEX   (4, 0x8a): /* movrs r/m,r8 */
+    case X86EMUL_OPC_EVEX   (4, 0x8b): /* movrs r/m,reg */
+    case X86EMUL_OPC_EVEX_66(4, 0x8b): /* movrs r/m,r16 */
         vcpu_must_have(movrs);
         dst.val = src.val;
         break;




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.