Subject: Re: assembler syntax
To: None <port-m68k@netbsd.org>
From: Ignatios Souvatzis <is@netbsd.org>
List: port-m68k
Date: 06/30/2002 08:37:32
--VbJkn9YxBvnuCH5J
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sun, Jun 30, 2002 at 06:25:56AM +0200, Klaus Heinz wrote:
> Hi,
>=20
> 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:
>=20
> int vgar(volatile caddr_t ba, int idx)
> {
> register int erg;
> asm volatile ("movel %1, a0;\
this should be %a0 (or escaped version thereof).
> movel %2,d1;
this should be %d1 (or escaped version thereof).
> movel a0@(d1), %0;" :\
> "=3Dr" (erg):\
> "g" (ba), "d" (idx) :\
> "a0", "d0", "d1");
this should be %a0, %d0 and %d1 (or escaped version thereof).
> return erg;
> }
>=20
>=20
> This gets translated into:
>=20
> ...
> #APP
> movel %d2, a0; movel %d3,d1;
> movel a0@(d1), %d2;
> #NO_APP
> ...
>=20
> and 'as' complains about:
>=20
> /tmp/cc1Pws5c.s:41: Error: syntax error -- statement `movel a0@(d1),%d2=
' ignored
>=20
>=20
> From what I have found, I think every register name should be preceded by
> a '%' (%% in the C source file).
>=20
> Without the % in front of the register names, 'as' translates the above
> (according to objdump) to:
>=20
> 10: 23c2 0000 0000 movel %d2,0 <vgar>
> 16: 23c3 0000 0000 movel %d3,0 <vgar>
> 1c: 2430 0170 0000 movel %a0@(00000000),%d2
yes, because without the prefix the assembler doesn't know it is a=20
register. This is the new toolchain.
>=20
> which seems not to be the intended output:
>=20
> 10: 2042 moveal %d2,%a0
> 12: 2203 movel %d3,%d1
> 14: 2430 1800 movel %a0@(00000000,%d1:l),%d2
>=20
>=20
> Can someone confirm this?
>=20
> 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?
yes.
=20
Regards,
Ignatios
--VbJkn9YxBvnuCH5J
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org
iD8DBQE9HqcsPCRcZ/VMtk4RAgwbAKCBoASpX9EgVPcW/Aqy/4NJr03WCACaAi7K
RssHs3slfLUjDKUc0l+a5yk=
=9+GS
-----END PGP SIGNATURE-----
--VbJkn9YxBvnuCH5J--