movem for coldfire FW: [netburner.com #22025]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




-----Original Message-----
From: Jerry Auth [mailto:gauth@xxxxxxxxx]
Sent: Saturday, October 18, 2008 11:24 AM
To: 'support@xxxxxxxxxxxxx'
Subject: RE: [netburner.com #22025] 


I could get the movem to save and restore the registers, however it stepped on the subroutine return address.  Further investigation shows that the gcc assembler has coded this instruction backwards.  Instead of using predecrement when saving the registers, it uses post increment.  Naturally this wreaks hob with the stack.  It appears I am not alone http://gcc.gnu.org/ml/gcc-help/2007-03/msg00352.html  Now if we could only get back to the state of perfection of the assemblers from a quarter ago, my life would be easier.  It also remains troubling that the contents of the stack pointer are unchanged after executing a movem.  Why is this?

I reread the CFPRM and the stack is definitely moving toward lower numbered addresses as JSRs are executed.  This means that re-entrant code needs to stack the registers in the same direction.  The CFPRM seems to allow the MOVEM instruction to use either direction.  68000 Assembly Language Programming by Leventhal, Hawkins, Kane, and Cramer (Second Edition) page 434 implies pushing the registers towards lower numbered address.  All of this implies an error in gcc.

-----Original Message-----
From: support@xxxxxxxxxxxxx [mailto:support@xxxxxxxxxxxxx]
Sent: Monday, October 13, 2008 9:52 AM
To: gauth@xxxxxxxxx
Subject: [netburner.com #22025] 


I think the Coldfire assembly is one of the better assembly
environments, but its not perfect.
I agree with your comments.

Paul

> [gauth@xxxxxxxxx - Mon Oct 13 09:31:53 2008]:
> 
> Well that is wierd.  This assembler is entirely too helpful.  It
>    chooses predecrement for storing the registers and postincrement to
>    retrieve them.  All without a word of warning.  This must be one of
>    those priesthood things that is hidden from the novitiate.  Leaving
>    the stackpointer unchanged is not what I would have chosen either.
> 
> -----Original Message-----
> From: support@xxxxxxxxxxxxx [mailto:support@xxxxxxxxxxxxx]
> Sent: Monday, October 13, 2008 8:09 AM
> To: gauth@xxxxxxxxx
> Subject: [netburner.com #22025]
> 
> 
> You have to adjust the SP yourself.
> The postdecrement does not work for movem....
> 
>    lea      -60(%a7),%a7
>    movem.l  %d0-%d7/%a0-%a6,(%a7)
> 
> 
> 
> 



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux