gpt4 book ai didi

assembly - MIPS 中如何处理五个或更多参数?

转载 作者:行者123 更新时间:2023-12-02 09:12:31 26 4
gpt4 key购买 nike

我对汇编语言非常陌生。我正在阅读有关 MIPS 架构的内容,但我被一个概念所困扰。

MIPS has four argument registers $a0, $a1, $a2 and $a3. These special purpose registers are used to hold the parameters passed from the caller procedure to the callee procedure.

如果函数有超过 4 个参数,因为只有四个寄存器来保存参数,会发生什么情况?提前致谢。

最佳答案

它们在堆栈上传递,引用自 Wikipedia :

The O32 ABI defined by the MIPS passes the first four arguments to a function in the registers $a0-$a3; subsequent arguments are passed on the stack. The return value (or a pointer to it) is stored in register $v0; a second return value may be stored in $v1. The 64 bit ABI allows for more arguments in registers for more efficient function calls when there are more than four parameters. There is also the N32 ABI which also allows for more arguments in registers.

更多 herehere (PDF 警告)。

关于assembly - MIPS 中如何处理五个或更多参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6944304/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com