{"id":1290,"date":"2018-10-24T21:10:05","date_gmt":"2018-10-24T13:10:05","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=1290"},"modified":"2018-10-24T21:13:16","modified_gmt":"2018-10-24T13:13:16","slug":"%e4%b8%89%e7%a7%8d%e5%b8%b8%e7%94%a8%e7%9a%84%e5%87%bd%e6%95%b0%e8%b0%83%e7%94%a8%e7%ba%a6%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/assembler\/2018\/10\/24\/2110051290.html","title":{"rendered":"\u4e09\u79cd\u5e38\u7528\u7684\u51fd\u6570\u8c03\u7528\u7ea6\u5b9a"},"content":{"rendered":"<p>1\u3001\u51fd\u6570\u8c03\u7528\u5728\u6c47\u7f16\u4e2d\uff0c\u6709\u5173\u4e8e\u53c2\u6570\u4f20\u9012\u4e0e\u6808\u5e73\u8861\u7684\u95ee\u9898\uff0c\u53ef\u53c2\u7167<a href=\"http:\/\/www.yusian.com\/blog\/assembler\/2018\/10\/24\/173913.html\" rel=\"noopener\" target=\"_blank\">\u51fd\u6570\u8c03\u7528\u5728\u6c47\u7f16\u4e2d\u7684\u57fa\u672c\u5b9e\u73b0<\/a>\uff0c\u4e3b\u8981\u6709\u4e09\u79cd\u65b9\u5f0f__cdecl\u3001__stdcall\u3001__fastcall\uff1b<br \/>\n2\u3001\u5728C++\u4ee3\u7801\u4e2d\uff0c\u53ef\u4ee5\u5728\u51fd\u6570\u540d\u524d\u52a0\u8fd9\u4e09\u4e2a\u5173\u952e\u5b57\u6765\u8bbe\u5b9a\u7f16\u8bd1\u65b9\u5f0f\uff0c\u5148\u4e0a\u4ee3\u7801\uff1a<\/p>\n<pre lang=\"cpp\" line=\"1\">\/\/ VCTest.cpp : Defines the entry point for the console application.\r\n\/\/\r\n\r\n#include \"stdafx.h\"\r\n\r\nint __cdecl sum1(int a, int b)\r\n{\r\n\treturn a + b;\r\n}\r\nint __stdcall sum2(int a, int b)\r\n{\r\n\treturn a + b;\r\n}\r\nint __fastcall sum3(int a, int b)\r\n{\r\n\treturn a + b;\r\n}\r\nint main(int argc, char* argv[])\r\n{\r\n\tsum1(2, 3);\r\n\tsum2(2, 3);\r\n\tsum3(2, 3);\r\n\treturn 0;\r\n}<\/pre>\n<p>3\u3001\u65ad\u70b9\u53cd\u6c47\u7f16<\/p>\n<pre lang=\"asm\" line=\"1\">20:       sum1(2, 3);\r\n;\u53c2\u6570\u4ece\u53f3\u81f3\u5de6\u4f20\u9012\uff0c\u5916\u5e73\u6808\uff0c\u4fee\u6539esp\u503c\r\n0040D7A8   push        3\r\n0040D7AA   push        2\r\n0040D7AC   call        @ILT+20(print) (00401019)\r\n0040D7B1   add         esp,8\r\n21:       sum2(2, 3);\r\n;\u53c2\u6570\u4ece\u53f3\u81f3\u5de6\u4f20\u9012\uff0c\u5185\u5e73\u6808\uff0c\u540e\u9762\u518d\u8d34\u51fa\u51fd\u6570\u5185\u90e8\u5b9e\u73b0\r\n0040D7B4   push        3\r\n0040D7B6   push        2\r\n0040D7B8   call        @ILT+30(sum2) (00401023)\r\n22:       sum3(2, 3);\r\n;\u53c2\u6570\u4ece\u53f3\u81f3\u5de6\uff0c\u76f4\u63a5\u4f7f\u7528\u5bc4\u5b58\u5668\uff0c\u4e0d\u9700\u8981\u5e73\u6808\r\n0040D7BD   mov         edx,3\r\n0040D7C2   mov         ecx,2\r\n0040D7C7   call        @ILT+25(sum3) (0040101e)\r\n<\/pre>\n<p>3.1\u3001__stdcall sum3()\u5185\u90e8\u53cd\u6c47\u7f16\uff0c\u6700\u540e\u4e00\u53e5ret 8<\/p>\n<pre lang=\"asm\" line=\"1\">10:   int __stdcall sum2(int a, int b)\r\n11:   {\r\n00401050   push        ebp\r\n00401051   mov         ebp,esp\r\n00401053   sub         esp,40h\r\n00401056   push        ebx\r\n00401057   push        esi\r\n00401058   push        edi\r\n00401059   lea         edi,[ebp-40h]\r\n0040105C   mov         ecx,10h\r\n00401061   mov         eax,0CCCCCCCCh\r\n00401066   rep stos    dword ptr [edi]\r\n12:       return a + b;\r\n00401068   mov         eax,dword ptr [ebp+8]\r\n0040106B   add         eax,dword ptr [ebp+0Ch]\r\n13:   }\r\n0040106E   pop         edi\r\n0040106F   pop         esi\r\n00401070   pop         ebx\r\n00401071   mov         esp,ebp\r\n00401073   pop         ebp\r\n00401074   ret         8  ;\u5185\u5e73\u6808\uff01\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u51fd\u6570\u8c03\u7528\u5728\u6c47\u7f16\u4e2d\uff0c\u6709\u5173\u4e8e\u53c2\u6570\u4f20\u9012\u4e0e\u6808\u5e73\u8861\u7684\u95ee\u9898\uff0c\u53ef\u53c2\u7167\u51fd\u6570\u8c03\u7528\u5728\u6c47\u7f16\u4e2d\u7684\u57fa\u672c\u5b9e\u73b0\uff0c\u4e3b\u8981\u6709\u4e09\u79cd\u65b9\u5f0f__cdecl\u3001__stdcall\u3001__fastcall\uff1b 2\u3001\u5728C++\u4ee3\u7801\u4e2d\uff0c\u53ef\u4ee5\u5728\u51fd\u6570\u540d\u524d\u52a0\u8fd9\u4e09\u4e2a\u5173\u952e\u5b57\u6765\u8bbe\u5b9a\u7f16\u8bd1\u65b9\u5f0f\uff0c\u5148\u4e0a\u4ee3\u7801\uff1a \/\/ VCTest.cpp : Defines the entry point for the console application. \/\/ #include &#8220;stdafx.h&#8221; int __cdecl sum1(int a, int b) { return a + b; } int __stdcall sum2(int a, int b) { return a + b; } int __fastcall sum3(int a, int b) { return a + b; } int main(int argc, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[124],"tags":[129,130,126,131],"class_list":["post-1290","post","type-post","status-publish","format-standard","hentry","category-assembler","tag-asm","tag-assembler","tag-126","tag-131"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=1290"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1290\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=1290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=1290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=1290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}