gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > Is the stack always word-aligned?

#12702 - poslundc - Sun Nov 23, 2003 4:58 pm

It seems like it should be... is it considered illegal (or at least against spec) for me to branch to a function if the stack pointer is not word-aligned?

I just want to be sure that I can safely use ldr/str, which only work on word-aligned boundaries. I use ldm and stm with the stack all the time, but according to the ARM docs they (might) work even if the stack pointer isn't word-aligned.

Thanks,

Dan.

#12703 - tepples - Sun Nov 23, 2003 5:37 pm

Yes. Most RISC architectures' procedure calling conventions require the stack pointer to be aligned to some logical word size. You can assume that you can use ldr or ldm on the stack.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.