Inline Assembly queries

Paul Mackerras paulus at samba.org
Tue Jun 30 19:52:45 EST 2009


kernel mailz writes:

> Consider atomic_add and atomic_add_return in kernel code.
> I am not able to figure out why "memory" is added in latter

The "memory" indicates that gcc should not reorder accesses to memory
from one side of the asm to the other.  The reason for putting it on
the atomic ops that return a value is that they are sometimes used to
implement locks or other synchronization primitives.

Paul.


More information about the Linuxppc-dev mailing list