Subject: assembler syntax
To: None <port-m68k@netbsd.org>
From: Klaus Heinz <k.heinz.jun.zwei@onlinehome.de>
List: port-m68k
Date: 06/30/2002 06:25:56
Hi,
I am unfamiliar with gcc/as assembler syntax (gcc 2.95.3, as 2.11.2,
NetBSD 1.6_BETA3). The following code has a problem:
int vgar(volatile caddr_t ba, int idx)
{
register int erg;
asm volatile ("movel %1, a0;\
movel %2,d1;
movel a0@(d1), %0;" :\
"=3Dr" (erg):\
"g" (ba), "d" (idx) :\
"a0", "d0", "d1");
return erg;
}
This gets translated into:
...
#APP
movel %d2, a0; movel %d3,d1;
movel a0@(d1), %d2;
#NO_APP
...
and 'as' complains about:
/tmp/cc1Pws5c.s:41: Error: syntax error -- statement `movel a0@(d1),%d2' =
ignored
=46rom what I have found, I think every register name should be preceded by
a '%' (%% in the C source file).
Without the % in front of the register names, 'as' translates the above
(according to objdump) to:
10: 23c2 0000 0000 movel %d2,0 <vgar>
16: 23c3 0000 0000 movel %d3,0 <vgar>
1c: 2430 0170 0000 movel %a0@(00000000),%d2
which seems not to be the intended output:
10: 2042 moveal %d2,%a0
12: 2203 movel %d3,%d1
14: 2430 1800 movel %a0@(00000000,%d1:l),%d2
Can someone confirm this?
As the cvs log tells me this functions's file was last modified in 1997,
I suppose there has been some change in assembler syntax since then?
Can anyone tell me where to find more information about the changes?
I fear there will be some more places which need to be changed.
ciao
Klaus