

x64 ABI: Intro to the Windows x64 Calling Convention - gaoprea
http://www.altdevblogaday.com/2012/05/24/x64-abi-intro-to-the-windows-x64-calling-convention/

======
davvid
This article helped me a bit when porting Shake to x86_64 (the first in the
series is linked from the article):

[http://blogs.msdn.com/b/oldnewthing/archive/2004/01/14/58579...](http://blogs.msdn.com/b/oldnewthing/archive/2004/01/14/58579.aspx)

The x86_64 calling convention can be a bit hairy. C.f.
<http://blog.nelhage.com/2010/10/amd64-and-va_arg/>

The best thing about really large C++ applications with assembly glue deep in
their core is that _nothing_ works until you rewrite the glue for the new
platform.

You can't debug the thing like a normal app when its hand-rolled threading and
mutex library from 1997 doesn't work. So you tread forward; only suckers use
debuggers. You can tell what it's _supposed_ to do by reading the assembly and
function names from the other platforms... (ppc, alpha (SGI), and i386 in this
case).

Naturally, none of the assembly parts had any documentation. Honestly, it's
probably good that they didn't (j/k). My guess as to what they were thinking:
"if they don't understand it then they shouldn't be writing the asm for the
next platform". I guess they were right.

Finally, you get the glue right and it's an "ah-ha" moment. Everything
suddenly starts working.

