RISC-V呼叫约定的ABI注册名称 [英] ABI Register Names for RISC-V Calling Convention
问题描述
我对RISC-V ABI寄存器名称感到困惑.例如,第85页的"RISC-V指令集手册,第I卷:用户级ISA,版本2.0"中的表18.2指定堆栈指针 sp
是寄存器 x14 代码>.但是,说明
I'm confused about the RISC-V ABI Register Names. For example, Table 18.2 in the "RISC-V Instruction Set Manual, Volume I: User-Level ISA, Version 2.0" at page 85 specifies that the stack pointer sp
is register x14
. However, the instruction
addi sp,zero,0
riscv64-unknown-elf-as将
编译为0x00000113( -m32
没有区别).二进制:
is compiled to 0x00000113 by riscv64-unknown-elf-as (-m32
does not make a difference). In binary:
000000000000 00000 000 00010 0010011
^imm ^rs1 ^f3 ^rd ^opcode
因此,这里的 sp
似乎是 x2
.然后我在Google上搜索了一下,并找到了 RISC-V Linux用户手册.该文档指出 sp
是 x30
.
So here sp
seems to be x2
. Then I googled a bit and found the RISC-V Linux User's Manual. This document states that sp
is x30
.
那是什么?有不同的ABI吗?我可以通过命令行选项将ABI设置为 riscv64-unknown-elf-*
吗?那里有一张综合桌子吗?
So what is it? Are there different ABIs? Can I set the ABI with a command line option to riscv64-unknown-elf-*
? Is there a comprehensive table somewhere?
推荐答案
堆栈指针现在为 x2
.
此处是当前的ABI文档,已从用户级ISA规范中移出,现在包含该文档.相同的链接.
Here is the current ABI documentation, which has been moved out of the User-Level ISA specification, which now contains that same link.
对ABI进行了修改,以更好地适应新的RISC-V压缩规范,该规范将x8-x15中的8个最常用的寄存器彼此相邻.
The ABI was modified to better accommodate the new RISC-V compressed spec, which puts the 8 most-used registers next to each other in x8-x15.
注意:不信任任何非riscv.org网页.Quan Nguyen在其简介中明确指出,"RISC-V Linux用户手册"用于记录移植过程,并且不能保证准确性.
Note: do not trust ANY non riscv.org webpage. Quan Nguyen makes this clear in his introduction that the "RISC-V Linux User's Manual" is for documenting the porting process and that accuracy is NOT guaranteed.
这篇关于RISC-V呼叫约定的ABI注册名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!