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.

Speaking of link/unlk - is there any way to turn it off within one function? Why
does the compiler insert "link a6,0"?
Also, how does it deal with the stack and local variables when you turn it off
entirely?

On a completely unrelated note: are higher-priority interrupts triggered when
you are inside another interrupt?


 / Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF Quote follows:

"There must be a hundred silver dollars in here," moaned Boggis, waving a
purse. "I mean, that's not my league. That's not my class. I can't handle
that sort of money. You've got to be in the Guild of Lawyers or something
to steal that much."
       -- (Terry Pratchett, Wyrd Sisters)




Follow-Ups: References: