No, the stacks grow downwards. In systems where there is only one
stack, that is ususally set to the high end of (a typically monolithic)
memory
area and the heap is placed in the low end. The two grow towards each
other. The same is done here, except that there are two stacks. The IRQ
stack is set up to be small (and if you have specific requirements for a
larger
one you can adjust that.) There is a block of memory set asside at the very
high end. My assumption is that this may be some required scratchpad RAM
for the BIOS. Then the IRQ stack grows down from its initial value and the
User stack grows down towards the IWRAM heap. Thus the User stack can
grow substantially more than the IRQ one and that is OK.
Does that make sense, or did I just stir the mud?
- John
----- Original Message -----
From: "Jason Wilkins" <fenix@...>
To: <gbadev@yahoogroups.com>
Sent: Friday, March 21, 2003 9:13 AM
Subject: [gbadev] stack
> How does the stack on the Gameboy Advance work?
>
> Jeff's crt0.S sets the user and irq stack pointers high in IWRAM (160 and
> 92 bytes respectively). This implies to me that these stacks grow upwards
> in memory. Giving the irq stack 92 bytes and the user stack 160 - 92 = 68
> bytes.
>
> This looks to odd to me, and knowing that stacks ussually grow downward in
> memory towards the top of the heap then maybe they really grow downwards,
> giving the irq stack 68 and the user stack all of iwram (or until it
> corrupts any variables stored there).
>
> If so, then what is the 92 bytes left free at the top? I seem to recall
> there being a third stack on the ARM7TDMI, is this for bios calls?
>
> I knew all of this once upon a time, but looking at everything again is
> serving to confuse me, not clarify ^_^
>
> Looking at the linkscript and crt0.S for devkitadvance again is making me
> have a lot of "What the hell!" moments which one gets when they look at
> cod ethey wrote years ago.
>
>
>
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>