This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [m68k] asm regression with 3.3/3.4/3.5

> -----Original Message-----
> From: gcc-owner On Behalf Of Ian Lance Taylor
> Sent: 12 May 2004 17:13

> If you must use A6 for other reasons--if the subroutine expects
> it--then you need to declare _bn to be volatile.

  Use of a6 to point to the base of a library is part of the amiga ABI.
Rather than dynamically linking libraries into executables, OS syscalls are
performed by loading the base address of a library into a6, and then calling
through an entry in a jump table that immediately precedes the library base.
The library is allowed to assume a6 points to it's own base address in its
internal code, so you can't call via any of the other registers.

  We all know how hazardous it is to try writing this stuff offline, and I
don't have an m68k compiler to hand to test this with and it's been ermm....
quite a few years since I last wrote m68k assembler (and it was in moto
rather than gas format too), but here's what I was thinking was a first
approximation to a solution:

static inline int osfunc (int v1, int v2)
int rv;

  asm ("mov.l %1,d0; mov.l %2, a0;
        mov.l #0xdeadbeef, d1; mov.l #0xdeadbeef, a1;
        mov.l %3,a6; jsr a6@(-0x84:W); mov.l d0, %0"
     : "g" (rv)
     : "g" (v1), "g" (v2), "g" (base)
     : "d0", "d1", "cc", "memory", "a0", "a1", "a6");
  return rv;

  Hm.  I guess that's going to cause unnecessary register motion.  Meh.

Can't think of a witty .sigline today....

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]