RISC-V の Calling Convention

いつも忘れがちなので、備忘録。

Register ABI Name Description
x0 zero zero
x1 ra Return address
x2 sp Stack pointer
x3 gp Global pointer
x4 tp Thread pointer
x5-7 t0-t2 Temporaries
x8 s0/fp Saved Register/ Frame pointer
x9 s1 Saved Register
x10-x11 a0-a1 Function arguments/ return valus
x12-x17 a2-a7 Function arguments
x18-x27 s2-s11 Saved Resgieters
x28-x31 t3-t6 Temporaries