linux-mips
[Top] [All Lists]

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

To: linux-mips@linux-mips.org
Subject: Is "memory" clobber required for all inline asm which does atomic operation???
From: "Ashok.A" <ashok_kumar_ak@yahoo.com>
Date: Fri, 11 Jun 2004 04:49:48 -0700 (PDT)
Cc: ashok_kumar_ak@yahoo.com
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
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/ 

<Prev in Thread] Current Thread [Next in Thread>
  • Is "memory" clobber required for all inline asm which does atomic operation???, Ashok.A <=