* new to "__asm__ " macro...
@ 2001-08-10 23:07 Raghava Raju
2001-08-10 23:43 ` Frank Rowand
2001-08-13 21:23 ` Jan Roelens
0 siblings, 2 replies; 3+ messages in thread
From: Raghava Raju @ 2001-08-10 23:07 UTC (permalink / raw)
To: linuxppc-embedded
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__,
SMP_WMB, SMP_MB, "r","=&r","=m","cc",1: .
2) Is it that %0,%2,%3 denote addresses of old,mask,p
respectively.
3) Say if it is PowerPc then how should I
access registers r1,r2 etc, that is what is the exact
syntax.
4) I think in power PC we can't access
directly the contents of memory, but we should
give addresses of memory in registers then use
registers in instructions to access memory. But in
above example he is using %3 in lwarx command
accessing that memory directly. Is my interpretation
of above instructions wrong.
5) Some people use "memory" in place of "cc" ,
like I want to know what are these things.
6) Finally I want to write a simple programme
to write the contents of a local variable "xyz" into
register r33, then store the contents of r33 into
local variable "abc". Kindly would u give me a sample
code of doing it.
Thanks in advance.
Raghava.
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: new to "__asm__ " macro...
2001-08-10 23:07 new to "__asm__ " macro Raghava Raju
@ 2001-08-10 23:43 ` Frank Rowand
2001-08-13 21:23 ` Jan Roelens
1 sibling, 0 replies; 3+ messages in thread
From: Frank Rowand @ 2001-08-10 23:43 UTC (permalink / raw)
To: Raghava Raju; +Cc: linuxppc-embedded
Raghava Raju wrote:
>
> hi
>
> I want some basic insights into assembly level code
> emmbedded in C language.Following is the code of
You can find a description of this at
http://www.objsw.com/docs/gcc_89.html#SEC89
> 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__,
> SMP_WMB, SMP_MB, "r","=&r","=m","cc",1: .
>
> 2) Is it that %0,%2,%3 denote addresses of old,mask,p
> respectively.
>
> 3) Say if it is PowerPc then how should I
> access registers r1,r2 etc, that is what is the exact
> syntax.
>
> 4) I think in power PC we can't access
> directly the contents of memory, but we should
> give addresses of memory in registers then use
> registers in instructions to access memory. But in
> above example he is using %3 in lwarx command
> accessing that memory directly. Is my interpretation
> of above instructions wrong.
>
> 5) Some people use "memory" in place of "cc" ,
> like I want to know what are these things.
>
> 6) Finally I want to write a simple programme
> to write the contents of a local variable "xyz" into
> register r33, then store the contents of r33 into
> local variable "abc". Kindly would u give me a sample
> code of doing it.
-Frank
--
Frank Rowand <frank_rowand@mvista.com>
MontaVista Software, Inc
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: new to "__asm__ " macro...
2001-08-10 23:07 new to "__asm__ " macro Raghava Raju
2001-08-10 23:43 ` Frank Rowand
@ 2001-08-13 21:23 ` Jan Roelens
1 sibling, 0 replies; 3+ messages in thread
From: Jan Roelens @ 2001-08-13 21:23 UTC (permalink / raw)
To: Raghava Raju; +Cc: linuxppc-embedded
See http://linuxassembly.org/linasm.html
Raghava Raju 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__,
> SMP_WMB, SMP_MB, "r","=&r","=m","cc",1: .
>
> 2) Is it that %0,%2,%3 denote addresses of old,mask,p
> respectively.
>
> 3) Say if it is PowerPc then how should I
> access registers r1,r2 etc, that is what is the exact
> syntax.
>
> 4) I think in power PC we can't access
> directly the contents of memory, but we should
> give addresses of memory in registers then use
> registers in instructions to access memory. But in
> above example he is using %3 in lwarx command
> accessing that memory directly. Is my interpretation
> of above instructions wrong.
>
> 5) Some people use "memory" in place of "cc" ,
> like I want to know what are these things.
>
> 6) Finally I want to write a simple programme
> to write the contents of a local variable "xyz" into
> register r33, then store the contents of r33 into
> local variable "abc". Kindly would u give me a sample
> code of doing it.
>
> Thanks in advance.
> Raghava.
>
--
Jan Roelens
roelensj@agcs.com
815-784-7527
(8-991-7527)
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-08-13 21:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-10 23:07 new to "__asm__ " macro Raghava Raju
2001-08-10 23:43 ` Frank Rowand
2001-08-13 21:23 ` Jan Roelens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).