gregames 2003/12/04 14:14:16
Modified: atomic/unix apr_atomic.c
Log:
be sure that _add and _inc use 32 bit instructions. Also make sure gcc
knows we want the same register for an input and an output operand.
Revision Changes Path
1.30 +4 -4 apr/atomic/unix/apr_atomic.c
Index: apr_atomic.c
===================================================================
RCS file: /home/cvs/apr/atomic/unix/apr_atomic.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -b -u -r1.29 -r1.30
--- apr_atomic.c 4 Dec 2003 20:06:03 -0000 1.29
+++ apr_atomic.c 4 Dec 2003 22:14:16 -0000 1.30
@@ -105,9 +105,9 @@
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem,
apr_uint32_t val)
{
- asm volatile ("lock; xadd %1, (%2)"
+ asm volatile ("lock; xaddl %1, (%2)"
: "=r"(val) /* output, same as 1st input */
- : "r"(val), "r"(mem) /* inputs */
+ : "0"(val), "r"(mem) /* inputs */
: "%1","memory"); /* tell gcc they are clobbered */
return val;
}
@@ -141,9 +141,9 @@
{
apr_uint32_t val = 1;
- asm volatile ("lock; xadd %1, (%2)"
+ asm volatile ("lock; xaddl %1, (%2)"
: "=r"(val) /* output, same as 1st input */
- : "r"(val), "r"(mem) /* inputs */
+ : "0"(val), "r"(mem) /* inputs */
: "%1","memory"); /* tell gcc they are clobbered */
return val;
}