在标准的RISC-V中,栈总是向低地址增长的,并且sp总是16字节对齐的。 除了参数和返回值寄存器,RISC-V还有七个整数寄存器(t0至t6),12个浮点数寄存器(ft0至ft11)用于暂存,它们在函数调用过程中是易失的。如果想要长期使用暂存的数据使用,函数调用方必须自己保存。12个整数寄存器(s0至s11)和12个浮点数寄存器(fs0至...
对于caller saved和callee saved寄存器有点不清楚,参考RISC-V手册总结一下: 函数调用过程通常分为 6 个阶段[Patterson and Hennessy 2017]。 将参数存储到被调用的函数可以访问到的位置; 跳转到函数起始位置; 获取函数需要的局部存储资源,按需保存寄存器(callee saved registers) ; 执行函数中的指令; 将返回值...
调用者保存(Caller-saved):临时寄存器(t0-t6)和参数寄存器(a0-a7)。调用函数前,调用者需要保存这些寄存器的值。 被调用者保存(Callee-saved):保存寄存器(s0-s11)和返回地址寄存器(ra)。被调用函数需要保存和恢复这些寄存器的值。 # 调用者函数caller_function:# 保存调用者保存寄存器addisp,sp, -16sdra,8(sp) ...
The purpose of this section is to describe the RISC-V specific instruction sequences with their associated relocations in addition to the general purpose machine word sized relocations that are used for symbol addresses in the Global Offset Table or DWARF meta data. The following table provides det...