This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
c inline assembly
- From: ratheesh kannoth <ratheesh dot ksz at gmail dot com>
- To: linux-c-programming at vger dot kernel dot org, gcc-help at gcc dot gnu dot org
- Date: Sat, 18 Feb 2012 11:31:12 +0530
- Subject: c inline assembly
- Authentication-results: mr.google.com; spf=pass (google.com: domain of ratheesh.ksz@gmail.com designates 10.112.98.103 as permitted sender) smtp.mail=ratheesh.ksz@gmail.com; dkim=pass header.i=ratheesh.ksz@gmail.com
- References: <CAGZFCEEaJ7ZsNAmWCF-nDtsjs70U7fqEVvTXEaCt9Tmk1dcemQ@mail.gmail.com>
I am using gcc on a 32bit? intel machine.? i have defined an inline function.
This function is inline .? what all registers needs to pushed and
poped in the inline assembly so that the functions wont
disturb the registers in? the function ( in which it is C inlined? ).
inline unsigned long hello(unsigned long a)
{
int b;
asm ("movl %1, %%eax;
" movl %1, %%ebx;
"movl %1, %%ecx;
"movl %1, %%esi;
"movl %1, %%edi;
? "movl %%eax, %0;"
:"=r"(b) /* output */
:"r"(a) /* input */
);
}