]> xenbits.xensource.com Git - xen.git/commitdiff
x86emul: avoid double memory read for RORX
authorJan Beulich <jbeulich@suse.com>
Thu, 14 Nov 2024 12:03:18 +0000 (13:03 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 14 Nov 2024 12:03:18 +0000 (13:03 +0100)
Originally only twobyte_table[0x3a] determined what part of generic
operand fetching (near the top of x86_emulate()) comes into play. When
ext0f3a_table[] was added, ->desc was updated to properly describe the
ModR/M byte's function. With that generic source operand fetching came
into play for RORX, rendering the explicit fetching in the respective
case block redundant (and wrong at the very least when MMIO with side
effects is accessed).

While there also make a purely cosmetic / documentary adjustment to
ext0f3a_table[]: RORX really is a 2-operand insn, MOV-like in that it
only writes its destination register.

Fixes: 9f7f5f6bc95b ("x86emul: add tables for 0f38 and 0f3a extension space")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/decode.c
xen/arch/x86/x86_emulate/x86_emulate.c

index 0a0751f2ed4720576f887dbab14df644cf7ca5e3..7ce97c4726dc08368c5b0c5665322f7a59bc8303 100644 (file)
@@ -521,7 +521,7 @@ static const struct ext0f3a_table {
     [0xce ... 0xcf] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0xde] = { .simd_size = simd_other },
     [0xdf] = { .simd_size = simd_packed_int, .two_op = 1 },
-    [0xf0] = {},
+    [0xf0] = { .two_op = 1 /* Mov */ },
 };
 
 static const opcode_desc_t xop_table[] = {
index c91d048d2624d19e4d26d01c808aae567b8b2e14..0600df789c2876f88b0465d98906341405aadcf8 100644 (file)
@@ -7699,11 +7699,6 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f3a, 0xf0): /* rorx imm,r/m,r */
         vcpu_must_have(bmi2);
         generate_exception_if(vex.l || vex.reg != 0xf, X86_EXC_UD);
-        if ( ea.type == OP_REG )
-            src.val = *ea.reg;
-        else if ( (rc = read_ulong(ea.mem.seg, ea.mem.off, &src.val, op_bytes,
-                                   ctxt, ops)) != X86EMUL_OKAY )
-            goto done;
         if ( mode_64bit() && vex.w )
             asm ( "rorq %b1,%0" : "=g" (dst.val) : "c" (imm1), "0" (src.val) );
         else