x86-64 asm cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Registers | |
Caller-saved Callee-saved | |
RAX RCX RSP RDI RSI RDX R8 R9 R10 R11 RBP RBX R12 R13 R14 R15 | |
Args: RDI, RSI, RDX, RCX, R8, R9, XMM0–7 | |
Return: RAX | |
Simple Compile | |
yasm -f macho64 foo.asm && gcc foo.c foo.o -Wall -Wextra -g -O1 | |
Template | |
section .text | |
global _func | |
_func: | |
push rbp | |
mov rbp,rsp | |
pop rbp | |
ret | |
If you don't push/pop, the stack gets misaligned. If you do, it's aligned to | |
16-byte boundary. If not: 8-byte. | |
https://github.com/webmproject/libvpx/blob/master/vpx_ports/x86_abi_support.asm | |
https://en.wikipedia.org/wiki/X86_instruction_listings | |
http://www.agner.org/optimize/instruction_tables.pdf | |
http://www.agner.org/optimize/microarchitecture.pdf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment