5 ms·
x86_64 please. https://software.intel.com/sites/default/files/m/d/4/1/d/8/Introduction_to_x64_Assembly.pdf https://software.intel.com/sites/default/files/m/d/4
by CalChris 8y ago
x86_64 please.
https://software.intel.com/sites/default/files/m/d/4/1/d/8/Introduction_to_x64_Assembly.pdf https://software.intel.com/sites/default/files/m/d/4/1/d/8/I...
https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatsheet.pdf https://cs.brown.edu/courses/cs033/docs/guides/x64_cheatshee...
https://web.stanford.edu/class/archive/cs/cs107/cs107.1194/guide/x86-64.html https://web.stanford.edu/class/archive/cs/cs107/cs107.1194/g...
- npo_ 8y agoThese links are amazing. I would have never found these. I've been looking for good introductory resources for the past few days now. So glad to see this pop up in my news reader. Thank you!
- warmwaffles 8y agoArchived the stanford one in case it becomes dead https://web.archive.org/web/20190406155050/https://web.stanford.edu/class/archive/cs/cs107/cs107.1194/guide/x86-64.html https://web.archive.org/web/20190406155050/https://web.stanf...
- W-Stool 8y agoVery useful, thank you!
- moggi 8y agoAlso the awesome pdfs by Agner Fog that everyone doing x86-64 programming should read: https://agner.org/optimize/ https://agner.org/optimize/
- Arelius 8y agoAwesome! Any chance you, or anyone else has documentation on x86_64 Windows calling conventions? That's where I've been getting stuck.
- afranchuk 8y agoIIRC: 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...
- CalChris 8y agohttps://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019 https://docs.microsoft.com/en-us/cpp/build/x64-calling-conve... After you read that, you might want to look at the LLVM source https://github.com/llvm-mirror/llvm/blob/master/lib/Target/X86/X86CallingConv.td https://github.com/llvm-mirror/llvm/blob/master/lib/Target/X... /// The C convention as implemented on Windows/x86-64 and /// AArch64. This convention differs from the more common /// \c X86_64_SysV convention in a number of ways, most notably in /// that XMM registers used to pass arguments are shadowed by GPRs, /// and vice versa. /// On AArch64, this is identical to the normal C (AAPCS) calling /// convention for normal functions, but floats are passed in integer /// registers to variadic functions.