assembly - Memory occupied by STP instruction -
assume following instruction:
stp x29, x30, [sp, -32]!
assuming stack pointer @ address 0, address x29
, x30
stored:
- option 1:
[sp-16]
,[sp-32]
- option 2:
[sp-32]
,[sp-40]
i know stack grows towards low addresses, whenever storing occupy towards growing addresses, hence think 'option 1' right answer.
what think?
regardless of addressing modes, memory accessess of more 1 byte start @ given base address , ascend, "option 2" 1 part either side of base address not right. beware initial stack pointer of 0 invalid given you're trying store below - result of address calculation underflows or overflows architecturally unknown, whilst hardware might happen produce expected address, shouldn't rely on it.
in case, if example initial sp
0x1000, you'd have bytes of first register (x29
) stored addresses 0x0fe0..0xfe7 (in appropriate order current endianness), bytes of second (x30
) stored 0xfe8..0xfef, , 0xfe0 written sp
.
Comments
Post a Comment