A function (parent function) performs the
following tasks when it calls another function (child function).
- The calling function (parent) is
responsible for preserving any save-on-call registers across the call that are live across
the call. (The save-on-call registers are R0-R3 and R12 (alternate names are A1-A4 and
V9).)
- If the called function (child) returns a structure, the caller
allocates space for the structure and passes the address of that space to the called
function as the first argument.
- The caller places the first arguments in
registers R0-R3, in that order. The caller moves the remaining arguments to the argument
block in reverse order, placing the leftmost remaining argument at the lowest address.
Thus, the leftmost remaining argument is placed at the top of the stack.
- If arguments were stored onto the
argument block in step 3, the caller reserves a word in the argument block for dual-state
support. (See Section 6.11 for more information.)