S0 and S1 register usage

17 views
Skip to first unread message

Tao Liu

unread,
Jun 30, 2024, 7:32:53 AM (3 days ago) Jun 30
to RISC-V SW Dev
hi, folks, 

I am confused about using S0 and S1 register when reading the spec. What is "saved register"? It seems it can be used as frame pointer as well. Can I use it for other purpose? 

Thanks. 

Tommy Murphy

unread,
Jun 30, 2024, 8:03:19 AM (3 days ago) Jun 30
to Tao Liu, RISC-V SW Dev
What specific text in what specification document/version are you having problems with?

You may also want to refer to the ABI spec if you haven't already:


s0/s1 are callee saved registers.
The ABI spec says:

"The presence of a frame pointer is optional. If a frame pointer exists, it must reside in x8 (s0); the register remains callee-saved."

Tao Liu

unread,
Jun 30, 2024, 10:15:52 AM (3 days ago) Jun 30
to RISC-V SW Dev, tommy_...@hotmail.com, Tao Liu
thanks for the quick reply! wonderful guidance and problem sovled! 
Reply all
Reply to author
Forward
0 new messages