This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: using __asm__
- To: Tat Kee Tan <tktan at EE dot Princeton dot EDU>
- Subject: Re: using __asm__
- From: paul rodriguez <prodrig at eece dot unm dot edu>
- Date: Thu, 10 May 2001 11:04:03 -0600 (MDT)
- cc: binutils at sourceware dot cygnus dot com
Hi. You can use something as:
static __inline__ void your_function(long *ptr_flag,long *ptr_usp)
{
__asm__ __volatile__(
"mov (%0),%%r0 \n\t"
"mov (%1),%%r1 \n\t"
:
: "r" (ptr_flag), "r" (ptr_usp)
: "memory");
return;
}
where ptr_flag = &flag, ptr_usp = &usp
You can look into the kernel for more examples
Paul
On Thu, 10 May 2001, Tat Kee Tan wrote:
> I wish to have these asm in C using __asm__
>
> mov r0, flags
> mov r1, usp
>
> where flags and usp are 32bit long C variable.
> how should I do that ?
>
> The doc in info gcc is not clear at all.
>
> tatkee