Find the bottom/top of the stack | developer.brewmp.com Find the bottom/top of the stack | developer.brewmp.com

Developer

Find the bottom/top of the stack

Forums:

Ok.....so we all know that if we have a function

void foo()
{
int a;

that &a will hold the point to the top of the stack (more or less).

But, is there any way to get the bottom of the stack? I see a function to SET the bottom of the stack but... nothing to just get it. Is it even possible to do correctly?

Thanks!

On that same note.... what about in a cooperative threading application?
How are the stack frames set up in that case? Is it contiguous (ie: if one thread is paused and switches to an already running thread, what happens with the stack pointer?)

On that same note.... what about in a cooperative threading application?
How are the stack frames set up in that case? Is it contiguous (ie: if one thread is paused and switches to an already running thread, what happens with the stack pointer?)

KAJed wrote:On that same note.... what about in a cooperative threading application?
How are the stack frames set up in that case? Is it contiguous (ie: if one thread is paused and switches to an already running thread, what happens with the stack pointer?)
the stack of a thread is on the heap, and the stack size is set by the developer in ITHREAD_Start so you can easily calculate the bottom of the stack. SP gets set whenever you resume a thread.

KAJed wrote:On that same note.... what about in a cooperative threading application?
How are the stack frames set up in that case? Is it contiguous (ie: if one thread is paused and switches to an already running thread, what happens with the stack pointer?)
the stack of a thread is on the heap, and the stack size is set by the developer in ITHREAD_Start so you can easily calculate the bottom of the stack. SP gets set whenever you resume a thread.

Are you sure about this? I'm looking at all those addresses on the stacks...and threads don't seem to be in the heap.
Im running the emulator (simulator) with a dll built in VC++ Express.... my stack runs from about 0x0012f3a0 (bottom) to...well somewhere lower than that since it grows 'down'
MY heap runs from about 0x02053be0 to 0x023e34f4 (not quite but close... i have a lot of that reserved for some important things that shouldn't be examined)
Statics run from about 0x00320000 to 0x0032004f0 (or something similar to that)
and the addresses of locals on the stack inside of a thread are around 0x00340000
If i have TWO threads running the second stack is around 0x00350000....
So.... where exactly are these heap stacks, because the addresses of those thread locals doesn't make sense.

Are you sure about this? I'm looking at all those addresses on the stacks...and threads don't seem to be in the heap.
Im running the emulator (simulator) with a dll built in VC++ Express.... my stack runs from about 0x0012f3a0 (bottom) to...well somewhere lower than that since it grows 'down'
MY heap runs from about 0x02053be0 to 0x023e34f4 (not quite but close... i have a lot of that reserved for some important things that shouldn't be examined)
Statics run from about 0x00320000 to 0x0032004f0 (or something similar to that)
and the addresses of locals on the stack inside of a thread are around 0x00340000
If i have TWO threads running the second stack is around 0x00350000....
So.... where exactly are these heap stacks, because the addresses of those thread locals doesn't make sense.

KAJed wrote:Are you sure about this? I'm looking at all those addresses on the stacks...and threads don't seem to be in the heap.
They certainly aren't on the stack!
KAJed wrote:
Im running the emulator (simulator) with a dll built in VC++ Express.... my stack runs from about 0x0012f3a0 (bottom) to...well somewhere lower than that since it grows 'down'
MY heap runs from about 0x02053be0 to 0x023e34f4 (not quite but close... i have a lot of that reserved for some important things that shouldn't be examined)
Statics run from about 0x00320000 to 0x0032004f0 (or something similar to that)
and the addresses of locals on the stack inside of a thread are around 0x00340000
If i have TWO threads running the second stack is around 0x00350000....
So.... where exactly are these heap stacks, because the addresses of those thread locals doesn't make sense.
I'm guessing somewhere inside an IHeap allocated internally by BREW. No idea what the mapping of that to X86 memory layout is and don't really care, I only care about ARM stuff most of the time.

KAJed wrote:Are you sure about this? I'm looking at all those addresses on the stacks...and threads don't seem to be in the heap.
They certainly aren't on the stack!
KAJed wrote:
Im running the emulator (simulator) with a dll built in VC++ Express.... my stack runs from about 0x0012f3a0 (bottom) to...well somewhere lower than that since it grows 'down'
MY heap runs from about 0x02053be0 to 0x023e34f4 (not quite but close... i have a lot of that reserved for some important things that shouldn't be examined)
Statics run from about 0x00320000 to 0x0032004f0 (or something similar to that)
and the addresses of locals on the stack inside of a thread are around 0x00340000
If i have TWO threads running the second stack is around 0x00350000....
So.... where exactly are these heap stacks, because the addresses of those thread locals doesn't make sense.
I'm guessing somewhere inside an IHeap allocated internally by BREW. No idea what the mapping of that to X86 memory layout is and don't really care, I only care about ARM stuff most of the time.

Unfortunately we have to do a lot of our testing on the emulator as we don't have enough devices to go around, and we have one node locked license for the compiler.

Unfortunately we have to do a lot of our testing on the emulator as we don't have enough devices to go around, and we have one node locked license for the compiler.

KAJed wrote:Unfortunately we have to do a lot of our testing on the emulator as we don't have enough devices to go around, and we have one node locked license for the compiler.
V3C is about 120 dollars now, and WinARM is free.

KAJed wrote:Unfortunately we have to do a lot of our testing on the emulator as we don't have enough devices to go around, and we have one node locked license for the compiler.
V3C is about 120 dollars now, and WinARM is free.

V3C?
I tried moving us over to WinARM and had a LOT of issues... though I still want it to be optional to use that. Eventually when I find the time I will try to migrate us. However, not having many devices to test on is limiting as well.

V3C?
I tried moving us over to WinARM and had a LOT of issues... though I still want it to be optional to use that. Eventually when I find the time I will try to migrate us. However, not having many devices to test on is limiting as well.

KAJed wrote:V3C?
Motorola V3C - i.e. a reasonable test device.

KAJed wrote:V3C?
Motorola V3C - i.e. a reasonable test device.