]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
x86/shadow: remove a few 32-bit hypervisor leftovers
authorJan Beulich <jbeulich@suse.com>
Tue, 9 Feb 2016 12:24:23 +0000 (13:24 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 9 Feb 2016 12:24:23 +0000 (13:24 +0100)
... related to 8-byte cmpxchg having required special precautions
there.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/shadow/common.c
xen/arch/x86/mm/shadow/types.h

index f3f49e04b98fd488e34d5a7c3b3845bf2ee2deeb..22708385e9cb7a3b5f20395a7a5f6a0d79da8ea8 100644 (file)
@@ -259,10 +259,10 @@ hvm_emulate_cmpxchg(enum x86_segment seg,
     struct sh_emulate_ctxt *sh_ctxt =
         container_of(ctxt, struct sh_emulate_ctxt, ctxt);
     struct vcpu *v = current;
-    unsigned long addr, old[2], new[2];
+    unsigned long addr, old, new;
     int rc;
 
-    if ( !is_x86_user_segment(seg) )
+    if ( !is_x86_user_segment(seg) || bytes > sizeof(long) )
         return X86EMUL_UNHANDLEABLE;
 
     rc = hvm_translate_linear_addr(
@@ -270,15 +270,12 @@ hvm_emulate_cmpxchg(enum x86_segment seg,
     if ( rc )
         return rc;
 
-    old[0] = new[0] = 0;
-    memcpy(old, p_old, bytes);
-    memcpy(new, p_new, bytes);
-
-    if ( bytes <= sizeof(long) )
-        return v->arch.paging.mode->shadow.x86_emulate_cmpxchg(
-            v, addr, old[0], new[0], bytes, sh_ctxt);
+    old = new = 0;
+    memcpy(&old, p_old, bytes);
+    memcpy(&new, p_new, bytes);
 
-    return X86EMUL_UNHANDLEABLE;
+    return v->arch.paging.mode->shadow.x86_emulate_cmpxchg(
+               v, addr, old, new, bytes, sh_ctxt);
 }
 
 static const struct x86_emulate_ops hvm_shadow_emulator_ops = {
@@ -335,21 +332,18 @@ pv_emulate_cmpxchg(enum x86_segment seg,
 {
     struct sh_emulate_ctxt *sh_ctxt =
         container_of(ctxt, struct sh_emulate_ctxt, ctxt);
-    unsigned long old[2], new[2];
+    unsigned long old, new;
     struct vcpu *v = current;
 
-    if ( !is_x86_user_segment(seg) )
+    if ( !is_x86_user_segment(seg) || bytes > sizeof(long) )
         return X86EMUL_UNHANDLEABLE;
 
-    old[0] = new[0] = 0;
-    memcpy(old, p_old, bytes);
-    memcpy(new, p_new, bytes);
-
-    if ( bytes <= sizeof(long) )
-        return v->arch.paging.mode->shadow.x86_emulate_cmpxchg(
-            v, offset, old[0], new[0], bytes, sh_ctxt);
+    old = new = 0;
+    memcpy(&old, p_old, bytes);
+    memcpy(&new, p_new, bytes);
 
-    return X86EMUL_UNHANDLEABLE;
+    return v->arch.paging.mode->shadow.x86_emulate_cmpxchg(
+               v, offset, old, new, bytes, sh_ctxt);
 }
 
 static const struct x86_emulate_ops pv_shadow_emulator_ops = {
index 6b9959d953ffc60311626f6c4ce245f4b8e01f17..503243fe1ef51a2c8c15666dd64f62923e7c26b6 100644 (file)
@@ -247,7 +247,6 @@ static inline shadow_l4e_t shadow_l4e_from_mfn(mfn_t mfn, u32 flags)
 #define sh_detach_old_tables       INTERNAL_NAME(sh_detach_old_tables)
 #define sh_x86_emulate_write       INTERNAL_NAME(sh_x86_emulate_write)
 #define sh_x86_emulate_cmpxchg     INTERNAL_NAME(sh_x86_emulate_cmpxchg)
-#define sh_x86_emulate_cmpxchg8b   INTERNAL_NAME(sh_x86_emulate_cmpxchg8b)
 #define sh_audit_l1_table          INTERNAL_NAME(sh_audit_l1_table)
 #define sh_audit_fl1_table         INTERNAL_NAME(sh_audit_fl1_table)
 #define sh_audit_l2_table          INTERNAL_NAME(sh_audit_l2_table)