This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: __asm__ usage??
- To: Raghava Raju <vraghava_raju at yahoo dot com>
- Subject: Re: __asm__ usage??
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Tue, 14 Aug 2001 17:52:55 +1000
- Cc: gcc-help at gcc dot gnu dot org
- References: <20010810214427.33952.qmail@web20008.mail.yahoo.com>
On 10-Aug-2001, Raghava Raju <vraghava_raju@yahoo.com> wrote:
> hi
>
> I want some basic insights into assembly level code
> emmbedded in C language. Following is the code of
> PowerPc ambedded in C languagge:
>
> unsigned long old,mask, *p;
>
> __asm__ __volatile__(SMP_WMB "\
> 1: lwarx %0,0,%3
> andc %0,%0,%2
> stwcx %0,0,%3
> bne 1b"
> SMP_MB
> : "=&r" (old), "=m" (*p)
> : "r" (mask), "r" (p), "m" (*p)
> : "cc");
>
> 1) what does these things denote: __volatile__,
See the GCC manual (the "Extended Asm" section
of the "C extensions" chapter).
> SMP_WMB, SMP_MB,
They are probably macros defined in the code.
> "r","=&r","=m", "cc"
See the GCC manual (the "Extended Asm" section
of the "C extensions" chapter, and the "Constraints"
section referenced there).
> and 1: .
>
> 2) Is it that %0,%2,%3 denote addresses of old,mask,p
> respectively.
Values of, not addresses of.
> 3) Say if it is PowerPc then how should I
> access registers r1,r2 etc, i.e. what is the exact
> syntax.
Consult the documentation for the PowerPC assembler.
> 5) Some people use "memory" in place of "cc" ,
> like I want to know what are these things.
See the GCC manual.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.