MIPS Stack Frame Layout (Windows Embedded CE 6.0)

1/5/2010

The stack frame consists of four areas:

  • Parameter or argument area
  • Local variable area
  • Register save area
  • 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.

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

Other Resources

MIPS Calling Sequence Specification