Variable passing C -> assembly, for m68k?

David Korn dkorn@pixelpower.com
Fri Oct 19 03:04:00 GMT 2001


>-----Original Message-----
>From: Larry Gray [ mailto:larry@greenmotor.com ]


>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.


  Huh?

  Can you elaborate what you mean here?  You aren't trying to reach
multiple levels up the stack, are you?  What's difficult about working
out the offset?  The args are pushed, you know from the function prototype
(yes, you can and should supply prototypes for asm routines that will be
called from C) how many args and what types they are, the subroutine is
called immediately after pushing the args, so on entry 0(sp) points to
your return addr, 4(sp) points to your first arg - always! - and subsequent
args are found by adding the (rounded according to alignment requirements)
size of each arg as you go past it.

  Where's the problem, maybe it's easier than you think ?


       DaveK
-- 
Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.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



More information about the crossgcc mailing list