On the allocation of static data in the MIPS architecture
When discussing the 32-bit MIPS architecture, Patterson--Hennessy explain that the static data segment starts at 0x 1000 0000
, ends at 0x 1000 FFFF
, with the global pointer $gp
set by default to the middle address 0x 1000 8000
. It is stated that the heap is next, and should thus start at 0x 1001 0000
.
Some experimenting with MARS however tells me that there is an additional segment lying in between, which goes from 0x 1001 0000
to 0x 1003 FFFF
, so that the heap only starts at 0x 1004 0000
. Indeed when I store say an array on the heap using a syscall, this array will be stored in 0x 1004 0000
onwards.
This additional segment seems to get used when I initialise data under the .data
header of my program. This confuses me, as I was under the expectation that data initialised under .data
was to be considered static, and should therefore be stored in the segment governed by the global pointer.
Question. Is the behaviour exhibited by MARS standard? If yes, in what way does this additional data segment, lying between the static data and the heap, differ from the static data segment lying in front of it?
from Recent Questions - Stack Overflow https://ift.tt/3lcEHM4
https://ift.tt/eA8V8J
Comments
Post a Comment