how to specify individual registers as constraints for the operands

李力 myfavor_linux at msn.com
Wed Feb 10 21:29:48 EST 2010


Dear all,
 
I am a newbie in this and I would like to know how to specify individual registers as constraints for the operands.
For example;
 
int foo(int x, int y)
{
           int z = x + y;
 
           printf("foo:  x = %d  y= %d\n ", x, y);
           return z;
}
 
void call_foo(void)
{
         int result;
         int arg1 =1, arg2=2;          
 
         asm("foo" : "=r"(result) : "r"(arg1),"r"(arg2));
         printf("call_foo result = %d\n",result);        
}
 
How can I ask gcc to put arg1 into r0 and arg2 into r1?
 
please help me what to do.
 
Regards,
 
Ming     
 		 	   		  
_________________________________________________________________
SkyDrive电子画册,带你领略精彩照片,分享“美”时“美”刻!
http://www.windowslive.cn/campaigns/e-magazine/ngmchina/?a=c


More information about the linux-arm mailing list