2.1 GCC Calling Convention

Arguments in a fixed argument list are assigned, from left to right, to registers r25 through r18. All arguments use an even number of registers. This results in char arguments consuming two registers. Additional arguments beyond that, which will fit in the registers, are passed on the stack.

Arguments in a variable argument list are pushed on the stack in right to left order. Char arguments consume two bytes.

Return values use the registers r25 through r18, depending on the size of the return value. The relationship between the register and the byte order is shown in Table 2-1.

Table 2-1. Relationship Between the Register and the Byte Order
Registerr19r18r21r20r23r22r25r24
Byte orderb7b6b5b4b3b2bb1b0