MIPS Stack Frame and Argument Registers
The stack frame consists of four areas; the parameter or argument area, the local variable area, the register save area, and the argument build area.
The calling function allocates space on the stack for all arguments, even though it may pass some of the arguments in registers. The calling function should reserve enough space on the stack for the maximum argument list required by calls from the calling function. The function must allocate space for at least four words, even if it passes fewer parameters. Functions should allocate space for all arguments, regardless of whether the function passes the arguments in registers. This provides a save area for the called function for saving argument registers if these registers need to be preserved.
The function allocates argument registers for the first argument. It allocates any argument registers remaining to the second argument, and so on until it uses all the argument registers or exhausts the argument list. All remaining parts of an argument and remaining arguments go on the stack.
It is helpful when thinking about argument register allocation to view the argument list as an unpacked structure in memory — the argument call area on the stack — where each argument is an appropriately aligned member of the structure. The argument register allocation preserves that same alignment as if in memory. When mapping some argument lists some argument registers may not contain anything relevant the same as padding space in memory.
See Also
MIPS Calling Sequence Specification | MIPS General Purpose Registers | MIPS Parameter Passing | MIPS Prolog and Epilog | MIPS pdata Format | MIPS Assembler Macros | MIPS I, II Argument Registers | MIPS IV Argument Registers | MIPS Frame and Stack Pointers | MIPS Leaf Routines
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.