Skip to content

Instantly share code, notes, and snippets.

@drguildo
Created December 4, 2021 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drguildo/326fc8219ffbb4365a8b3ba41a94dffd to your computer and use it in GitHub Desktop.
Save drguildo/326fc8219ffbb4365a8b3ba41a94dffd to your computer and use it in GitHub Desktop.

C data type sizes

C type Intel data type Assembly suffix Bytes
char Byte b 1
short Word w 2
int Double word l 4
long Quad word q 8
char * Quad word q 8
float Single precision s 4
double Double precision l 8

Registers

 63                               31               15       7      0
╔════════════════════════════════╦════════════════╦════════╦════════╗
║ %rax                           ║ %eax           ║ %ax    ║ %al    ║ Return value
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rbx                           ║ %ebx           ║ %bx    ║ %bl    ║ Callee saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rcx                           ║ %ecx           ║ %cx    ║ %cl    ║ 4th argument
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rdx                           ║ %edx           ║ %dx    ║ %dl    ║ 3rd argument
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rsi                           ║ %esi           ║ %si    ║ %sil   ║ 2nd argument
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rdi                           ║ %edi           ║ %di    ║ %dil   ║ 1st argument
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rbp                           ║ %ebp           ║ %bp    ║ %bpl   ║ Callee saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %rsp                           ║ %esp           ║ %sp    ║ %spl   ║ Stack pointer
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r8                            ║ %r8d           ║ %r8w   ║ %r8b   ║ 5th argument
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r9                            ║ %r9d           ║ %r9w   ║ %r9b   ║ 6th argument
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r10                           ║ %r10d          ║ %r10w  ║ %10b   ║ Caller saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r11                           ║ %r11d          ║ %r11w  ║ %11b   ║ Caller saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r12                           ║ %r12d          ║ %r12w  ║ %12b   ║ Callee saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r13                           ║ %r13d          ║ %r13w  ║ %13b   ║ Callee saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r14                           ║ %r14d          ║ %r14w  ║ %14b   ║ Callee saved
╠════════════════════════════════╬════════════════╬════════╬════════╣
║ %r15                           ║ %r15d          ║ %r15w  ║ %15b   ║ Callee saved
╚════════════════════════════════╩════════════════╩════════╩════════╝
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment