This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: Variable passing C -> assembly, for m68k?


On Thursday 18 October 2001 01:26, Kai Ruottu wrote:
> Larry Gray wrote:
> > Hello,
> >         I'm writing (and porting) some assembly language routines and
> > need to know how gcc handles variable passing. I've read through "Using
> > and Porting GCC", but can't find anything specific. It appears that in
> > some architectures it uses the stack in others registers. I know I can
> > use inline assembly and operand constraints, but would prefer to use
> > standalone assembly programs that can be called from my C program.
> >         Where could I find the specific details for how gcc handles this
> > for the m68k? Did I overlook it?
>
>  http://www.redhat.com/support/manuals/gnupro.html
>
>  The '99r1p1' manual with 'embed' in the name should have those 'calling
> conventions' etc. for most architectures...

Hello,
	Thanks, this had it. For anyone interested here's the summary for the m68k:

1. The m68k pushes everything onto the stack. This makes it difficult to 
determine the offset when calling multiple routines. I guess the only sure 
way is to compile with -S, or produce a listing file.
2. Use only d0, d1, a0, and a1, all others must remain unchanged.
3. Return values for integers are store in d0, and d1.

Thanks Again,
Larry Gray
larry@greenmotor.com

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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