x86_64 (SysV) calling convention
https://uclibc.org/docs/psABI-x86_64.pdf
not including vector and FP registers
register usage
-----------------------------------------------------------------------
register Usage preserved across calls
-----------------------------------------------------------------------
rax 1th return value No
temp (scratch) reg
-----------------------------------------------------------------------
rbx callee saved Yes
-----------------------------------------------------------------------
rdi fn parameter 1 No
-----------------------------------------------------------------------
rsi fn parameter 2 No
-----------------------------------------------------------------------
rdx fn parameter 3 No
-----------------------------------------------------------------------
rcx fn parameter 4 No
-----------------------------------------------------------------------
r8 fn parameter 5 No
-----------------------------------------------------------------------
r9 fn parameter 6 No
-----------------------------------------------------------------------
r10 function static chain ptr No
temp (scratch) reg
-----------------------------------------------------------------------
r11 temp (scratch) reg No
-----------------------------------------------------------------------
r12~r14 callee saved Yes
-----------------------------------------------------------------------
r15 callee saved Yes
optionally GOT base pointer
-----------------------------------------------------------------------
rsp stack pointer Yes
-----------------------------------------------------------------------
rbp callee saved
optionally frame pointer Yes
-----------------------------------------------------------------------
parameter passing (integer class only)
-----------------------------------------------------------------------
the first 6 parameters (left to right) are passed though register
rdi, rsi, rdx, rcx, r8, r9
further paramters are pushed to stack (right-to-left order)
^^^^^^^^^^^^^
-----------------------------------------------------------------------
TODO returning value