How are five or more arguments considered in MIPS?

I am very new to assembly language . I read about MIPS architecture and I stick to the concept.

MIPS has four arguments: the registers $ a0, $ a1, $ a2 and $ a3. These special target registers are used to store parameters passed from the calling procedure to the called party procedure.

What happens if a function has more than 4 arguments , since there are only four registers for storing the arguments ? Thanks in advance.

+6
source share
1 answer

They are passed on the stack, quoting Wikipedia :

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

More details here and here (PDF warning).

+5
source

Source: https://habr.com/ru/post/894302/


All Articles