Re: A89: placing data into C variables from ASM(" ") constructs
[Prev][Next][Index][Thread]
Re: A89: placing data into C variables from ASM(" ") constructs
> > move.w 4(%a6),%d0
>
> But isn't the SP a7? So wouldn't it be:
>
> move.w 4(%a7),%d0
>
> and isn't the reason that there a 4 bytes allocated by GCC because the top 4
> bytes are a longword representing the address that the currrent function
> should return to? Not just because it's using the LINK instruction?
a6 (customarily) is the frame pointer. Parameters to a function must
be accessed through a6 and not a7. Unless, of course, the entire
function is written in assembly, including the entry/exit parts.
Within a function it is advisable to access local data using a6 and
negative offsets for the use of alloca() can modify the stackpointer
in all sorts of ways. (If a function uses alloca(), then gcc will
generate link/unlk even if -fomit-frame-pointer is specified.)
Again, functions in which you have control of the entire function and
you don't call other functions, you can use a7 at any time.
Regards,
Zoltan
Follow-Ups:
References: