eal/x86: fix atomic cmpset
authorNikhil Rao <nikhil.rao@intel.com>
Thu, 29 Sep 2016 21:24:53 +0000 (02:54 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 26 Oct 2017 22:05:15 +0000 (00:05 +0200)
The original code used movl instead of xchgl, this caused
rte_atomic64_cmpset to use ebx as the lower dword of the source
to cmpxchg8b instead of the lower dword of function argument "src".

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Reported-by: Job Abraham <job.abraham@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Tested-by: Job Abraham <job.abraham@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/common/include/arch/x86/rte_atomic_32.h

index 2e04c75..fb3abf1 100644 (file)
@@ -81,7 +81,7 @@ rte_atomic64_cmpset(volatile uint64_t *dst, uint64_t exp, uint64_t src)
                        : "memory" );           /* no-clobber list */
 #else
        asm volatile (
-            "mov %%ebx, %%edi\n"
+            "xchgl %%ebx, %%edi;\n"
                        MPLOCKED
                        "cmpxchg8b (%[dst]);"
                        "setz %[res];"