Variable passing C -> assembly, for m68k?

David Korn
Fri Oct 19 03:04:00 GMT 2001

>-----Original Message-----
>From: Larry Gray [ ]

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


  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 ?

Burn your ID card!
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.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list