On Thu, Sep 15, 2005 at 12:48:05AM +1000, Nick Piggin wrote:
> This patch still needs work on arm (v6) and m32r. I would
> just be shooting in the dark if I attempted either myself.
ARMv6, something like:
int atomic_cmpxchg(atomic_t *ptr, int old, int new)
{
u32 oldval, res;
do {
asm(
"ldrex %1, [%2]\n\t"
"teq %1, %3\n\t"
"strexeq %0, %4, [%2]\n\t"
: "=&r" (res), "=&r" (oldval)
: "r" (&ptr->counter), "r" (old), "r" (new)
: "cc");
} while (res);
return oldval;
}
should do what you require.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|