This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

__asm__ usage??


   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"
	: "=&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" and 1: .
	2) Is it that %0,%2,%3 denote addresses of old,mask,p

        3) Say if it is PowerPc then how should I
access registers r1,r2 etc, i.e. what is the exact

        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.

Please reply to, since I am
not subscriber to list.

         Thanks in advance.

Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]