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

标签 assembly arguments mips

我对汇编语言非常陌生。我正在阅读有关 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/

相关文章:

postgresql - PostgreSQL 中函数参数的约束

golang 二进制文件不在 mips 上运行

assembly - 这个 "should not happen"崩溃是 AMD Fusion CPU 的错误吗?

assembly - CPUID 值错误?

string - 程序集 x86 : LEA and MOVSB changes my Source String?

python - Pandas lambda 多个参数返回

c - 微软怎么能说 WinAPI 中一个字的大小是 16 位呢?

java - 安卓 : How to set a default value for an argument variable

堆栈指针/程序计数器错误 MIP

mips - MIPS 分支指令上的偏移量是符号扩展的吗?