开发者

How are five or more arguments dealt in MIPS?

I am very new to Assembly language. I was reading about MIPS architecture and I am stuck with a concept.

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.

What would happen if the function has more than 4 arguments as there are only four registers to hold the arguments? Thanks in advan开发者_JAVA技巧ce.


They are passed on the stack, quoting from 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.

More here and here (PDF warning).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜