Is "memory" clobber required for all inline asm which does atomic operation???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Folks,

I am working on inline asm related staff. I couldn't
get proper answer for this question. So posting this
question here..... Expecting good response from you.

* Should we use "memory" clobber in *every* inline asm
  which does atomic operation? (In MIPS, 'll'/'sc'
  instructions are used to provide atomic operation)

As per my understanding, "memory" clobber will be
required for inline asm only if the corresponding
functions can be used to implement *lock* and *unlock*
primitives (or) memory modified by the inline asm
is *unknown*. Please correct me if I am wrong.

In the following URL, "memory" clobber has been
specified in the functions 'atomic_add_return' and
'atomic_sub_return'. But it is *not* specified in
the functions 'atomic_add' and 'atomic_sub'. WHY?

http://lxr.linux.no/source/include/asm-mips/atomic.h?v=2.6.5

Does it mean that 'atomic_add'/'atomic_sub' (which
returns 'void') can't be used to implement *lock*
and *unlock* primitives?

Please clarify it. Thanks in advance!

Expecting your responses ...

-AshokA


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux