7 ms·
IIRC: while it's not explicitly documented, x86_64 was late enough in the game that both windows and Unix systems have the same calling convention. Saves a lot
by afranchuk 8y ago
IIRC: while it's not explicitly documented, x86_64 was late enough in the game that both windows and Unix systems have the same calling convention. Saves a lot of hassle :)
- jcranmer 8y agoNope, the Windows ABI uses a different set of registers than the SysV (Unix) ABI. SysV uses rdi, rsi, rdx, rcx, r8, r9 (in that order), and Windows uses rcx, rdx, r8, r9 (in that order).
- billti 8y agoIt's not just the registers, the use of the stack (e.g. lack of a "red zone" on Windows) as well as the data used for exception handling are different too. The MSDN links above are quite detailed on what Windows implements. The post by Eli at https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64/ https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-... goes over some Windows differences towards the end.
- int_19h 8y agoThey do not use the same convention. AMD did define a calling convention as part of their SysV ABI spec, and pretty much everybody adopted that ABI... except for Windows. As to why, the best we have is informed speculation: https://stackoverflow.com/questions/4429398/why-does-windows64-use-a-different-calling-convention-from-all-other-oses-on-x86 https://stackoverflow.com/questions/4429398/why-does-windows...