This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: Problem with the stack on m68k


On Wed, 17 May 2000, Art Berggreen wrote:

> 
> Is your called function popping the passed arguments off the stack?
> In the standard C calling interface, it is the caller's responsibility
> to clean arguments off the stack.  If your subroutine doesn't return the
> stack pointer where the calling function expects, things will break.
> 
> Art
> 

Probably best explained if I past in my assembly routine

#include "asm.h"

	.title "rotate.S for gizmo"


/* Function specifer */

	.global	SYM(rotateright)

SYM(rotateright):

/* Load input variables from stack */
	move.l	(sp)+,a0
	move.l	(sp)+,d0
	move.l	(sp)+,d1

/* Rotate value and save in d0 */	
	ror.l	d1,d0

/* Return to call function */
	move.l a0,-(sp)
			 	
	rts

The calling convention I am assuming is the one described in the gnupro
manual (on cygnus's site).  The one that I was used to was pushing
the result onto the stack and then the return address.  If I am
wrong in assuming this.  

Noah Aklilu
aklilu@nyquist.ee.ualberta.ca
http://www.ee.ualberta.ca/~aklilu/
"Integrity is something you do when no one is looking"



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