Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4848

General • Re: risc v push pop alignment and other questions

$
0
0
Thanks for your response.

So if I push x1-x3 the stack gets aligned to 16 bytes.
It remains 16-byte-aligned if it is already 16-byte-aligned. (Also you can't push x1 - x3, but you can push ra, s0, s1.) The instruction doesn't force stack alignment, it just always adjusts sp in multiples of 16.
There is an empty 4 byte space at the bottom of the stack.
Yes
If I pop x1-x3 X1 is filled with random junk and my stack is all out of whack.
No, because cm.pop backs out all of the steps of cm.push in reverse. It loads from exactly the addresses where cm.push stored.
I suppose my objection/ confusion is that you basically need to push/pop multiples of 4 registers.
You can push ra, plus any number of registers in s0 through s11 (except you can't push exactly eleven of them, for encoding reasons)
But the encoding wastes space allowing you to do arbitrary push pops. A matching push and pop shouldn't do unexpected things.
Nope, it's a count, not a bitmap

Statistics: Posted by LukeW — Tue Nov 05, 2024 3:45 pm



Viewing all articles
Browse latest Browse all 4848

Trending Articles