From 11dbe97ca401221313dc233aa2d6f67dfcaef1a7 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 29 Mar 2004 17:43:58 +0000 Subject: nginx-0.0.3-2004-03-29-21:43:58 import --- src/core/ngx_atomic.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/core/ngx_atomic.h') diff --git a/src/core/ngx_atomic.h b/src/core/ngx_atomic.h index 17362aa32..311ef8892 100644 --- a/src/core/ngx_atomic.h +++ b/src/core/ngx_atomic.h @@ -21,13 +21,14 @@ static ngx_inline uint32_t ngx_atomic_inc(ngx_atomic_t *value) { uint32_t old; + old = 1; + __asm__ volatile ( - " movl $1, %0; " NGX_SMP_LOCK " xaddl %0, %1; " - : "=a" (old) : "m" (*value)); + : "=q" (old) : "m" (*value)); return old; } @@ -37,13 +38,14 @@ static ngx_inline uint32_t ngx_atomic_dec(ngx_atomic_t *value) { uint32_t old; + old = (uint32_t) -1; + __asm__ volatile ( - " movl $-1, %0; " NGX_SMP_LOCK " xaddl %0, %1; " - : "=a" (old) : "m" (*value)); + : "=q" (old) : "m" (*value)); return old; } @@ -62,7 +64,7 @@ static ngx_inline uint32_t ngx_atomic_cmp_set(ngx_atomic_t *lock, " setz %%al; " " movzbl %%al, %0; " - : "=a" (res) : "m" (*lock), "a" (old), "q" (set)); + : "+a" (res) : "m" (*lock), "a" (old), "q" (set)); return res; } -- cgit v1.2.3