I'm currently doing a deep-dive into Assembly land, mainly from the perspective of x86_64, C, and System V AMD64, generally targeting Linux.
It's pretty straightforward that the calling convention for integer (and by implication, pointer) values by using the following registers in order:
- RDI
- RSI
- RDX
- RCX
- R8
- R9
- XMM0–7
Longer argument counts are handled by pushing values onto the stack frame of the subroutine. I got these register names from the Wikipedia page on x86_64 calling conventions.
For larger values like structs and arrays, the convention also seems to be to push into the callee's stack frame.
However, what is the calling convention for floating-point arguments to functions? Are floating point registers used?
Another related question: what if I have mixed argument types?
void mixed(int a, float b, mystruct c) { /* ... */ }
If my function takes an arg list like this, how do I call such a function from Assembly? Which registers are used in interleaved arg lists like this?
a
goes intordi
,b
goes intoxmm0
andc
we can't tell :) – Lagging