Question

I have a question on memory addressing on x86 and MIPS. Now I am taking a computer organization class at my school and havin trouble because the professor's explanation is not so clear to me. What I know about the memory addressing is below.

The memory(stack) address start from top to bottom, the esp(stack pointer) points the top of the stack memory which has the highest memory. Whenever a memory is allocated on stack, the ebp(base pointer) goes down and memory is allocated.

Am I understood correct?? I have been looking for a clear and organized explanation on this but there are many resources that talks differently. And on this post the explanation says opposite to what I know about the memory. I need help!! thanks

Was it helpful?

Solution

The stack for different architectures may go different ways, and it is decided by the ABI of that architecture. Have a look at this link

If you are referring specifically to MIPS or x86, then yes, the stack pointer does go from higher to lower addresses. (And it follows LIFO, so whatever comes at the last is removed first).

It does not matter if its from top to bottom or vice-versa (looking at an inverted stack or non inverted stack), what matters is the stack goes from an address with a higher value to an address of a lower value (as in the link you provided)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top