x64 Linux C calling convention

Source: Internet
Author: User

"X86/x64 system exploration and programming" mentioned in x64 there is only one calling convention, respectively, using ecx,edx,edi,esi,r8d,r9d

Floating-point numbers use xmm0 ....

C Code:

#include "stdio.h" #include "string.h" void pp (int a,int b,int c,int d,int e,int F, int g, int h, int i,int j) {}void main () { PP (1,2,3,4,5,6,7,8,9,0);}

The disassembly code of the main function.

dump of assembler code for function main:   0x000000000040048e  <+0>:     push   rbp   0x000000000040048f  <+1>:     mov    rbp,rsp    0x0000000000400492 <+4>:     sub    rsp,0x20    0x0000000000400496 <+8>:     mov    dword  ptr [rsp+0x18],0x0   0x000000000040049e <+16>:    mov     dword ptr [rsp+0x10],0x9   0x00000000004004a6 <+24 >:    mov    DWORD PTR [rsp+0x8],0x8    0x00000000004004ae <+32>:    mov    dword ptr [ rsp],0x7   0x00000000004004b5 <+39>:    mov    r9d,0x6    0x00000000004004bb <+45>:    mov    r8d,0x5    0x00000000004004c1 <+51>:    mov    ecx,0x4    0x00000000004004c6 <+56>:    mov    edx,0x3    0x00000000004004cb <+61>:    mov    esi, 0x2   0x00000000004004d0 <+66>:    mov     edi,0x1   0x00000000004004d5 <+71>:    call    0x400474 <pp>   0x00000000004004da <+76>:    leave    0x00000000004004db <+77>:    ret

The assembly code shows that the GCC x64 call parameter order is edi,esi,edx,ecx,r8d,r9d,edi for the first parameter ESI is the second parameter, and so on, the remaining arguments are passed using the stack.

This article is from the "Backtrack-metasploit" blog, make sure to keep this source http://backtrackzone.blog.51cto.com/5612649/1662287

x64 Linux C calling convention

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.