Add to PiR's info..
r2 is the global data pointer
r3 is indeed the base register for library calls (just like a6)
Function call:
r0, r3-r12, f0-f13, cr0 & cr1 are scratch registers
r13-r31 must be preserved
Integer / pointer parameters are passed in r4-r10. If there are more, they are passed on the stack. Note 64-bit args are passed in pairs, eg r3/r4, r4/r5 etc
float / double args are passed in f0-f12 (?) additional args on the stack
Function return:
integer / pointer return in r3
long long return in r3/r4
float / double return in f0
Be careful with r0, it has implicit special meanings with lots of instructions.