Passing Arguments
Table of content
x64
Integer valued arguments in the leftmost four positions are passed in left-to-right order in RCX, RDX, R8, and R9, respectively. The fifth and higher arguments are passed on the stack.
Parameter type | fifth and higher | fourth | third | second | leftmost |
---|---|---|---|---|---|
Floating-point | stack | XMM3 | XMM2 | XMM1 | XMM0 |
Integer | stack | R9 | R8 | RDX | RCX |
Aggregates (8, 16, 32, or 64 bits) and __m64 | stack | R9 | R8 | RDX | RCX |
Other aggregates, as pointers | stack | R9 | R8 | RDX | RCX |
__m128, as a pointer | stack | R9 | R8 | RDX | RCX |
func1(int a, int b, int c, int d, int e, int f);
// a in RCX, b in RDX, c in R8, d in R9, f then e pushed on stack
func2(float a, double b, float c, double d, float e, float f);
// a in XMM0, b in XMM1, c in XMM2, d in XMM3, f then e pushed on stack
func3(int a, double b, int c, float d, int e, float f);
// a in RCX, b in XMM1, c in R8, d in XMM3, f then e pushed on stack
func4(__m64 a, __m128 b, struct c, float d, __m128 e, __m128 f);
// a in RCX, ptr to b in RDX, ptr to c in R8, d in XMM3,
// ptr to f pushed on stack, then ptr to e pushed on stack