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

[Xen-devel] [PATCH] x86/hvm: Set the emulation context correctly in hvmemul_cmpxchg()



hvmemul_cmpxchg() sets the read emulation context in p_new instead
of p_old, which is inconsistent (and wrong). We are now setting
p_old (even though it's unused) and adding a comment explaining
the change.

Suggested-by: Jan Beulich <JBeulich@xxxxxxxx>
Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index d759d3f..0cbb16e 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -1031,13 +1031,17 @@ static int hvmemul_cmpxchg(
 
     if ( unlikely(hvmemul_ctxt->set_context) )
     {
-        int rc = set_context_data(p_new, bytes);
+        int rc = set_context_data(p_old, bytes);
 
         if ( rc != X86EMUL_OKAY )
             return rc;
     }
 
-    /* Fix this in case the guest is really relying on r-m-w atomicity. */
+    /*
+     * Fix this in case the guest is really relying on r-m-w atomicity.
+     * Please note that while the set_context code is provided here for
+     * consistency, p_old is unused.
+     */
     return hvmemul_write(seg, offset, p_new, bytes, ctxt);
 }
 
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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