Cogs and Levers A blog full of technical stuff

64bit ABI Cheatsheet


Using a few different articles around the web, I thought it might be a good idea to aggregate all of the information around calling conventions in 64bit land. This could come in handy when wanting to write a cross OS compliant library at the assembly level. This particular article will directly target the assembly programming layer so that topics like C++ name mangling and caller clean-up are removed from its scope.



Windows will use RCX, RDX, R8 and R9 for the first four integer or pointer arguments. XMM0, XMM1, XMM2 and XMM3 are used for floating point arguments. Additional arguments are passed via the stack (right to left).

An integer or pointer return value will be returned in RAX. Floating point return will be in XMM0.

System V

System V operating systems will use RDI, RSI, RDX, RCX, R8 and R9. XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6 and XMM7 will be used to pass floating point parameters. RAX will hold the syscall number. Additional arguments are passed via the stack (right to left).

Return values are sent back via RAX.

Syscall Numbers

It’s interesting to note the structure of the syscall number when it comes time to execute. Looking at syscall_sw.h, you’ll see that apple machines want a 2 in the higher-order double word such that the write syscall, normally passed as 0x04 would be passed as 0x2000004 in OSX.

That’s it for today. Just a cheat sheet really.