Why is MIPS stack base 0x7ffffffc rather than 0x80000000

2

Why is MIPS stack base 0x7ffffffc rather than 0x80000000?

If I understand correctly, the stack pointer refers to the last item placed on the stack. So, if that's the case, doesn't that mean that address 0x7ffffffc never gets used because the conventional way to push an integer on the stack would be do decrement $sp to 0x7ffffff8 and place the pushed value there?

assembly
stack
mips
callstack
stack-pointer
asked on Stack Overflow Nov 2, 2020 by Zack • edited Nov 3, 2020 by Peter Cordes

1 Answer

2

The simulators (i.e. QtSPIM) do weird things with the stack pointer; they take action — such as to allocate additional memory for the stack — when the stack pointer is modified, rather than when the stack memory is stored into.  (As a result, you can give these simulators severe grief by putting a random value in the stack pointer register.)

My guess then is that since 0x80000000 is in protected kernel memory, they don't want that value in the register at all, and yes, this then means that a word of memory is never used.

I would venture that the actual hardware would not have this issue.

answered on Stack Overflow Nov 2, 2020 by Erik Eidt

User contributions licensed under CC BY-SA 3.0