diff options
author | Davi Arnaut <davi@apache.org> | 2007-08-04 21:00:43 +0000 |
---|---|---|
committer | Davi Arnaut <davi@apache.org> | 2007-08-04 21:00:43 +0000 |
commit | 418679e69b256f1307d5884117f22b6b57dcf3ea (patch) | |
tree | 1f1bfa3091fe663a18563bb96cdb38ae5a56abbd /atomic | |
parent | a1f4f3d91632e510b841e195e2fc6793b2bce0a8 (diff) | |
download | apr-418679e69b256f1307d5884117f22b6b57dcf3ea.tar.gz |
Cleanup asm constraints (+ operand is both read and written by the instruction)
and clobbers. The xchg instruction always asserts the lock signal.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@562765 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r-- | atomic/unix/ia32.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/atomic/unix/ia32.c b/atomic/unix/ia32.c index 191298c4a..3826f9275 100644 --- a/atomic/unix/ia32.c +++ b/atomic/unix/ia32.c @@ -83,10 +83,9 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint { apr_uint32_t prev = val; - asm volatile ("lock; xchgl %0, %1" - : "=r" (prev) - : "m" (*(mem)), "0"(prev) - : "memory"); + asm volatile ("xchgl %0, %1" + : "=r" (prev), "+m" (*mem) + : "0" (prev)); return prev; } @@ -112,15 +111,13 @@ APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with) { void *prev; #if APR_SIZEOF_VOIDP == 4 - asm volatile ("lock; xchgl %2, %1" - : "=a" (prev), "=m" (*mem) - : "r" (with), "m" (*mem) - : "memory"); + asm volatile ("xchgl %2, %1" + : "=a" (prev), "+m" (*mem) + : "0" (with)); #elif APR_SIZEOF_VOIDP == 8 - asm volatile ("lock; xchgq %q2, %1" - : "=a" (prev), "=m" (*mem) - : "r" ((unsigned long)with), "m" (*mem) - : "memory"); + asm volatile ("xchgq %q2, %1" + : "=a" (prev), "+m" (*mem) + : "r" ((unsigned long)with)); #else #error APR_SIZEOF_VOIDP value not supported #endif |