Sungju's Slow Life

Personal journal


Registers which are using when passing function arguments on x86_64

Brief notes for me which registers are used when passing function arguments on x86_64:

%rdi - 1st argument (%rdi:64, %edi:32, %di:16, %dl:8)

%rsi - 2nd argument (%rsi:64, %esi:32, %si:16, %sl:8)

%rdx - 3rd argument (%rdx:64, %edx:32, %dx:16, %dl:8)

%rcx - 4th argument (%rcx:64, %ecx:32, %cx:16, %cl:8)

%r8 - 5th argument (%r8:64, %r8d:32, %r8w:16, %r8b:8)

%r9 - 6th argument (%r9:64, %r9d:32, %r9w:16, %r9b:8)

%rsp - Stack pointer

%rax - Return value

http://pagead2.googlesyndication.com/pagead/show_ads.js

More detailed information about x86_64 registers and other useful instructions can be found here:

http://www.cs.cmu.edu/~fp/courses/15213-s06/misc/asm64-handout.pdf



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About Me

A software engineer who loves any technologies that makes life easier. That’s why I love Linux and Mac at the same time.

Newsletter

%d bloggers like this: