Use memory clobbers, to be on the safe side.

Suggested by:	jhb
This commit is contained in:
Olivier Houchard 2006-02-06 18:29:05 +00:00
parent 2a3b10658d
commit 123f34932c

View File

@ -163,7 +163,7 @@ atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_in
"moveq %1, #1\n"
"movne %1, #0\n"
: "=r" (ras_start), "=r" (done)
,"+r" (p), "+r" (cmpval), "+r" (newval));
,"+r" (p), "+r" (cmpval), "+r" (newval) : : "memory");
return (done);
}
@ -185,7 +185,8 @@ atomic_add_32(volatile u_int32_t *p, u_int32_t val)
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val));
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val)
: : "memory");
}
static __inline void
@ -207,7 +208,8 @@ atomic_subtract_32(volatile u_int32_t *p, u_int32_t val)
"mov %1, #0\n"
"str %1, [%0]\n"
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val));
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (val)
: : "memory");
}
static __inline void
@ -229,7 +231,8 @@ atomic_set_32(volatile uint32_t *address, uint32_t setmask)
"mov %1, #0\n"
"str %1, [%0]\n"
: "=r" (ras_start), "=r" (start), "+r" (address), "+r" (setmask));
: "=r" (ras_start), "=r" (start), "+r" (address), "+r" (setmask)
: : "memory");
}
static __inline void
@ -250,7 +253,8 @@ atomic_clear_32(volatile uint32_t *address, uint32_t clearmask)
"2:\n"
"mov %1, #0\n"
"str %1, [%0]\n"
: "=r" (ras_start), "=r" (start), "+r" (address), "+r" (clearmask));
: "=r" (ras_start), "=r" (start), "+r" (address), "+r" (clearmask)
: : "memory");
}
@ -272,7 +276,8 @@ atomic_fetchadd_32(volatile uint32_t *p, uint32_t v)
"2:\n"
"mov %3, #0\n"
"str %3, [%0]\n"
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (v));
: "=r" (ras_start), "=r" (start), "+r" (p), "+r" (v)
: : "memory");
return (start);
}