Variable passing C -> assembly, for m68k?

Larry Gray
Fri Oct 19 08:20:00 GMT 2001

On Friday 19 October 2001 06:08, David Korn wrote:
> >-----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.
>   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

	You're right, I was doing something boneheaded. I was using the frame 
pointer instead of the stack pointer.


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

More information about the crossgcc mailing list