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.
| Register | r19 | r18 | r21 | r20 | r23 | r22 | r25 | r24 |
|---|---|---|---|---|---|---|---|---|
| Byte order | b7 | b6 | b5 | b4 | b3 | b2b | b1 | b0 |
