shiningram
asked on
Atomic operations in assembly
Hi,
I want to write atomic operations (incr, dec, xchg, mod) which should support on almost all architectures.
Can anyone point me to resource available on thsi on net or in EE?
Someone explain what each following line is doing?
int32 func()
{
int32 val = -1;
asm volatile ("lock; xaddl %0,%1"
: "=r" (val), "=m" (*mem)
: "0" (val), "m" (*mem)
: "memory", "cc");
return val;
}
=r
=m
"0"
"m"
"memory"
What all these above do? Can someone explains all these? I am looking for resource/tutorial to understand these.
Thanks,
Ram
I want to write atomic operations (incr, dec, xchg, mod) which should support on almost all architectures.
Can anyone point me to resource available on thsi on net or in EE?
Someone explain what each following line is doing?
int32 func()
{
int32 val = -1;
asm volatile ("lock; xaddl %0,%1"
: "=r" (val), "=m" (*mem)
: "0" (val), "m" (*mem)
: "memory", "cc");
return val;
}
=r
=m
"0"
"m"
"memory"
What all these above do? Can someone explains all these? I am looking for resource/tutorial to understand these.
Thanks,
Ram
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Another question added to get clear suggestion from experts
ASKER
Can some one help writting increment and decrement atomic operations for linux and windos for 32 and 64 architecture.
Thanks,
Ram