diff --git a/arch/i386/atomic.h b/arch/i386/atomic.h index 95fecbdc..25441df2 100644 --- a/arch/i386/atomic.h +++ b/arch/i386/atomic.h @@ -88,7 +88,7 @@ static inline void a_dec(volatile int *x) static inline void a_store(volatile int *p, int x) { - __asm__( "movl %1, %0" : "=m"(*p) : "r"(x) : "memory" ); + __asm__( "movl %1, %0 ; lock ; orl $0,(%%esp)" : "=m"(*p) : "r"(x) : "memory" ); } static inline void a_spin() diff --git a/arch/x32/atomic.h b/arch/x32/atomic.h index b2014cc0..2ab1f7a2 100644 --- a/arch/x32/atomic.h +++ b/arch/x32/atomic.h @@ -83,7 +83,7 @@ static inline void a_dec(volatile int *x) static inline void a_store(volatile int *p, int x) { - __asm__( "mov %1, %0" : "=m"(*p) : "r"(x) : "memory" ); + __asm__( "mov %1, %0 ; mfence" : "=m"(*p) : "r"(x) : "memory" ); } static inline void a_spin() diff --git a/arch/x86_64/atomic.h b/arch/x86_64/atomic.h index b2014cc0..2ab1f7a2 100644 --- a/arch/x86_64/atomic.h +++ b/arch/x86_64/atomic.h @@ -83,7 +83,7 @@ static inline void a_dec(volatile int *x) static inline void a_store(volatile int *p, int x) { - __asm__( "mov %1, %0" : "=m"(*p) : "r"(x) : "memory" ); + __asm__( "mov %1, %0 ; mfence" : "=m"(*p) : "r"(x) : "memory" ); } static inline void a_spin()