summaryrefslogtreecommitdiff
path: root/arch/x86/lib
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/lib')
-rw-r--r--arch/x86/lib/atomic64_32.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c
index fd28fd3fb742..cd11803f9448 100644
--- a/arch/x86/lib/atomic64_32.c
+++ b/arch/x86/lib/atomic64_32.c
@@ -62,9 +62,17 @@ void atomic64_set(atomic64_t *ptr, u64 new_val)
*/
u64 atomic64_read(atomic64_t *ptr)
{
- u64 old = 1LL << 32;
+ u64 res;
- return cmpxchg8b(&ptr->counter, old, old);
+ asm volatile(
+ "mov %%ebx, %%eax\n\t"
+ "mov %%ecx, %%edx\n\t"
+ LOCK_PREFIX "cmpxchg8b %1\n"
+ : "+A" (res)
+ : "m" (*ptr)
+ );
+
+ return res;
}
/**