summaryrefslogtreecommitdiff
path: root/atomic
diff options
context:
space:
mode:
authordavi <davi@13f79535-47bb-0310-9956-ffa450edef68>2007-08-04 21:00:43 +0000
committerdavi <davi@13f79535-47bb-0310-9956-ffa450edef68>2007-08-04 21:00:43 +0000
commit5c615c820ba12e26e44ba2294ee0452391f408ff (patch)
tree1f1bfa3091fe663a18563bb96cdb38ae5a56abbd /atomic
parentab341fdf173c937656ae73fc5e3be9bf01cdfbb3 (diff)
downloadlibapr-5c615c820ba12e26e44ba2294ee0452391f408ff.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: http://svn.apache.org/repos/asf/apr/apr/trunk@562765 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'atomic')
-rw-r--r--atomic/unix/ia32.c21
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