Adam Hacks

Here is some basic documentation for the various calling conventions on x86_64 architectures. This information largely comes from Wikipedia.

System V AMD64 ABI

Systems utilizing this convention:

Registers Stack Order Stack Cleanup Notes
RDI, RSI, RDX, RCX, R8, R9, [XYZ]MM0-1 RTL (C) Caller Stack aligned on 16-byte boundary. 128-byte red zone below the stack. The kernel interface uses RDI, RSI, RDX, R10, R8, R9. In C++, this is the first parameter.

Microsoft x64 Calling Convention

Used by Microsoft Windows (Microsoft Visual C++, GCC, Intel C++ Compiler, Delphi), UEFI

Registers Stack Order Stack Cleanup Notes
RCX/XMM0, RDX/XMM1, R8/XMM2, R9/XMM3 RTL (C) Caller Stack aligned on 16-byte boundary. 32-bytes shadow space on stack. The specified 8 registers can only be used for parameters 1 through 4. For C++ classes, the hidden this parameter is the first parameter, passed in RCX.

Vectorcall

Used on Microsoft Windows (Microsoft Visual C++, Clang ICC)

Registers Stack Order Stack Cleanup Notes
RCX/[XY]MM0, RDX/[XY]MM1, R8/[XY]MM2, R9/[XY]MM3 + [XY]MM4-5 RTL (C) Caller Extended from MS x64.