This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch]: New operand parser for i386 intel syntax
- To: binutils at sourceware dot cygnus dot com
- Subject: Re: [patch]: New operand parser for i386 intel syntax
- From: Emmanuel Michon <emmanuel_michon at sdesigns dot com>
- Date: 26 Oct 2000 17:06:51 +0200
- Cc: Diego Novillo <dnovillo at cygnus dot com>
- References: <20001024130034.A28661@tornado.cygnus.com>
Diego Novillo <dnovillo@cygnus.com> writes:
> I have tested the patch with the GCC regression suite. It passes
> with no new regressions when compiled with -mintel-syntax
> (although I needed to patch the i386 backend to produce the
> correct syntax. I will submit a separate patch to gcc-patches).
1. Seems your patch is ok with ``as'' when you put intel style code inside
intel_syntax noprefix
mov eax,ecx
att_syntax
mov %ecx,%ecx
So, what's the meaning of noprefix?
2. gcc with -m-intel-syntax options just puts a
intel_syntax
at the very beginning of the .s output, what is it for?
3. What about accessing local/parameter variables from
inside inline assembly?
Let's take a look at the following (working) example:
------------------------
#include <stdio.h>
int bar1;
int substractfive()
{
asm( ".intel_syntax noprefix\n" );
// Intel syntax!!!
asm( "\tpush eax\n");
asm( "\tpush ebx\n");
asm( "\tmov eax,bar1\n" );
asm( "\tmov ebx,5\n" );
asm( "\tsub eax,ebx\n");
asm( "\tmov bar1,eax\n");
asm( "\t.att_syntax\n" );
// some AT&T for the pleasure.
asm( "\tpop %ebx\n");
asm( "\tpop %eax\n");
return bar1;
}
int main(int argc,char **argv)
{
bar1=8;
printf("8-5 = %d\n",substractfive());
return 0;
}
------------------------
How could we modify this code so that bar1 is
transferred as a parameter to:
int substractfive(int bar1)?
Normal gcc/at&t assembly would use constraints I think
to do that;
is there a way to avoid it?
Sincerely yours,
--
Emmanuel Michon
Ingénieur en développement logiciel
REALmagic France
Mobile: 0662834836 GPGkeyID: D2997E42