5.8.5.2 Software Stack Parameters

When a function is being encoded to use a reentrant model, the arguments to that function will be passed on the software stack or in dynamic working registers (see Software Stack Operation). Conventional software stack memory is used for arguments, unless the register-optimized reentrant stack is enabled, in which case arguments might be loaded to working registers.

When the conventional software stack is being used for arguments, those arguments are pushed onto the stack by the calling function in a reverse order to that in which the corresponding parameters appear in the function’s prototype. Subsequently, and if required, the called function will increase the value stored in the stack pointer to allocate storage for any auto or temporary variables it needs to allocate. When working registers are being used, they can be loaded in any order. The W register is never used by reentrant function arguments.

The arguments for unnamed parameters in functions that take a variable argument list (defined using an ellipsis in the prototype), are placed on the software stack, before those for the named parameters. Named parameters will use either the software stack or working registers, in the same way as ordinary parameters. After all the function’s arguments have been pushed, the total size of the unnamed parameters is pushed on to the stack. A maximum of 256 bytes of non-prototyped parameters are permitted per function.

As there is no frame pointer, accessing a C function's parameters (or other stack-based objects) is not recommended in hand-written assembly code. Accessing the working registers is possible, but the use of these registers can vary from build to build.