diff mbox

[3/6] x86emul: check for CMPXCHG8B availability

Message ID 58500DB802000078001289EF@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich Dec. 13, 2016, 2:03 p.m. UTC
We can't exclude someone wanting to hide the instruction from guests.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86emul: check for CMPXCHG8B availability

We can't exclude someone wanting to hide the instruction from guests.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1285,6 +1285,7 @@ static bool vcpu_has(
 }
 
 #define vcpu_has_fpu()         vcpu_has(         1, EDX,  0, ctxt, ops)
+#define vcpu_has_cx8()         vcpu_has(         1, EDX,  8, ctxt, ops)
 #define vcpu_has_cmov()        vcpu_has(         1, EDX, 15, ctxt, ops)
 #define vcpu_has_clflush()     vcpu_has(         1, EDX, 19, ctxt, ops)
 #define vcpu_has_mmx()         vcpu_has(         1, EDX, 23, ctxt, ops)
@@ -5296,7 +5297,10 @@ x86_emulate(
             op_bytes = 16;
         }
         else
+        {
+            vcpu_must_have(cx8);
             op_bytes = 8;
+        }
 
         old = container_of(&mmvalp->ymm[0], typeof(*old), u64[0]);
         aux = container_of(&mmvalp->ymm[2], typeof(*old), u64[0]);

Comments

Andrew Cooper Dec. 13, 2016, 2:27 p.m. UTC | #1
On 13/12/16 14:03, Jan Beulich wrote:
> We can't exclude someone wanting to hide the instruction from guests.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
diff mbox

Patch

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1285,6 +1285,7 @@  static bool vcpu_has(
 }
 
 #define vcpu_has_fpu()         vcpu_has(         1, EDX,  0, ctxt, ops)
+#define vcpu_has_cx8()         vcpu_has(         1, EDX,  8, ctxt, ops)
 #define vcpu_has_cmov()        vcpu_has(         1, EDX, 15, ctxt, ops)
 #define vcpu_has_clflush()     vcpu_has(         1, EDX, 19, ctxt, ops)
 #define vcpu_has_mmx()         vcpu_has(         1, EDX, 23, ctxt, ops)
@@ -5296,7 +5297,10 @@  x86_emulate(
             op_bytes = 16;
         }
         else
+        {
+            vcpu_must_have(cx8);
             op_bytes = 8;
+        }
 
         old = container_of(&mmvalp->ymm[0], typeof(*old), u64[0]);
         aux = container_of(&mmvalp->ymm[2], typeof(*old), u64[0]);