{"id":26922,"date":"2022-12-17T13:14:47","date_gmt":"2022-12-17T05:14:47","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=26922"},"modified":"2022-12-17T13:15:22","modified_gmt":"2022-12-17T05:15:22","slug":"gcc-how-to","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/gcc-how-to.html","title":{"rendered":"\u6700\u725bX\u7684GCC \u5185\u8054\u6c47\u7f16"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u6b63\u5982\u5927\u5bb6\u77e5\u9053\u7684\uff0c\u5728C\u8bed\u8a00\u4e2d\u63d2\u5165\u6c47\u7f16\u8bed\u8a00\uff0c\u5176\u662fLinux\u4e2d\u4f7f\u7528\u7684\u57fa\u672c\u6c47\u7f16\u7a0b\u5e8f\u8bed\u6cd5\u3002\u672c\u6587\u5c06\u8bb2\u89e3 GCC \u63d0\u4f9b\u7684\u5185\u8054\u6c47\u7f16\u7279\u6027\u7684\u7528\u9014\u548c\u7528\u6cd5\u3002\u5bf9\u4e8e\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\uff0c\u8fd9\u91cc\u53ea\u6709\u4e24\u4e2a\u524d\u63d0\u8981\u6c42\uff0c\u5f88\u660e\u663e\uff0c\u5c31\u662f x86 \u6c47\u7f16\u8bed\u8a00\u548c C \u8bed\u8a00\u7684\u57fa\u672c\u8ba4\u8bc6\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1. \u7b80\u4ecb<\/strong><\/div>\n
1.1 \u7248\u6743\u8bb8\u53ef<\/strong><\/span><\/div>\n

Copyright (C) 2003 Sandeep S.<\/p>\n

\u672c\u6587\u6863\u81ea\u7531\u5171\u4eab\uff1b\u4f60\u53ef\u4ee5\u91cd\u65b0\u53d1\u5e03\u5b83\uff0c\u5e76\u4e14\/\u6216\u8005\u5728\u9075\u5faa\u81ea\u7531\u8f6f\u4ef6\u57fa\u91d1\u4f1a\u53d1\u5e03\u7684 GNU \u901a\u7528\u516c\u5171\u8bb8\u53ef\u8bc1\u4e0b\u4fee\u6539\u5b83\uff1b\u4e5f\u53ef\u4ee5\u662f\u8be5\u8bb8\u53ef\u8bc1\u7684\u7248\u672c 2 \u6216\u8005\uff08\u6309\u7167\u4f60\u7684\u9700\u6c42\uff09\u66f4\u665a\u7684\u7248\u672c\u3002<\/p>\n

\u53d1\u5e03\u8fd9\u7bc7\u6587\u6863\u662f\u5e0c\u671b\u5b83\u80fd\u591f\u5e2e\u52a9\u522b\u4eba\uff0c\u4f46\u662f\u6ca1\u6709\u4efb\u4f55\u62c5\u4fdd\uff1b\u751a\u81f3\u4e0d\u5305\u62ec\u53ef\u552e\u6027\u548c\u9002\u7528\u4e8e\u4efb\u4f55\u7279\u5b9a\u76ee\u7684\u7684\u62c5\u4fdd\u3002\u5173\u4e8e\u66f4\u8be6\u7ec6\u7684\u4fe1\u606f\uff0c\u53ef\u4ee5\u67e5\u770b GNU \u901a\u7528\u8bb8\u53ef\u8bc1\u3002<\/p>\n

1.2 \u53cd\u9988\u6821\u6b63<\/strong><\/span><\/div>\n

\u8bf7\u5c06\u53cd\u9988\u548c\u6279\u8bc4\u4e00\u8d77\u63d0\u4ea4\u7ed9 Sandeep.S\u3002\u6211\u5c06\u611f\u8c22\u4efb\u4f55\u4e00\u4e2a\u6307\u51fa\u672c\u6587\u6863\u4e2d\u9519\u8bef\u548c\u4e0d\u51c6\u786e\u4e4b\u5904\u7684\u4eba\uff1b\u4e00\u88ab\u544a\u77e5\uff0c\u6211\u4f1a\u9a6c\u4e0a\u6539\u6b63\u5b83\u4eec\u3002<\/p>\n

1.3 \u81f4\u8c22<\/strong><\/span><\/div>\n

\u6211\u5bf9\u63d0\u4f9b\u5982\u6b64\u68d2\u7684\u7279\u6027\u7684 GNU \u4eba\u4eec\u8868\u793a\u771f\u8bda\u7684\u611f\u8c22\u3002\u611f\u8c22 Mr.Pramode C E \u6240\u505a\u7684\u6240\u6709\u5e2e\u52a9\u3002\u611f\u8c22\u5728 Govt Engineering College \u548c Trichur \u7684\u670b\u53cb\u4eec\u7684\u7cbe\u795e\u652f\u6301\u548c\u5408\u4f5c\uff0c\u5c24\u5176\u662f Nisha Kurur \u548c Sakeeb S \u3002 \u611f\u8c22\u5728 Gvot Engineering College \u548c Trichur \u7684\u8001\u5e08\u4eec\u7684\u5408\u4f5c\u3002<\/p>\n

\u53e6\u5916\uff0c\u611f\u8c22 Phillip , Brennan Underwood \u548c colin@nyx.net \uff1b\u8fd9\u91cc\u7684\u8bb8\u591a\u4e1c\u897f\u90fd\u539a\u989c\u5730\u76f4\u63a5\u53d6\u81ea\u4ed6\u4eec\u7684\u5de5\u4f5c\u6210\u679c\u3002
\n\"gnu-run\"<\/p>\n

2. \u6982\u89c8<\/strong><\/div>\n

\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u5b66\u4e60 GCC \u5185\u8054\u6c47\u7f16\u3002\u8fd9\u91cc\u5185\u8054\u8868\u793a\u7684\u662f\u4ec0\u4e48\u5462\uff1f<\/p>\n

\u6211\u4eec\u53ef\u4ee5\u8981\u6c42\u7f16\u8bd1\u5668\u5c06\u4e00\u4e2a\u51fd\u6570\u7684\u4ee3\u7801\u63d2\u5165\u5230\u8c03\u7528\u8005\u4ee3\u7801\u4e2d\u51fd\u6570\u88ab\u5b9e\u9645\u8c03\u7528\u7684\u5730\u65b9\u3002\u8fd9\u6837\u7684\u51fd\u6570\u5c31\u662f\u5185\u8054\u51fd\u6570\u3002\u8fd9\u542c\u8d77\u6765\u548c\u5b8f\u5dee\u4e0d\u591a\uff1f\u8fd9\u4e24\u8005\u786e\u5b9e\u6709\u76f8\u4f3c\u4e4b\u5904\u3002<\/p>\n

\u5185\u8054\u51fd\u6570\u7684\u4f18\u70b9\u662f\u4ec0\u4e48\u5462\uff1f<\/p>\n

\u8fd9\u79cd\u5185\u8054\u65b9\u6cd5\u53ef\u4ee5\u51cf\u5c11\u51fd\u6570\u8c03\u7528\u5f00\u9500\u3002\u540c\u65f6\u5982\u679c\u6240\u6709\u5b9e\u53c2\u7684\u503c\u4e3a\u5e38\u91cf\uff0c\u5b83\u4eec\u7684\u5df2\u77e5\u503c\u53ef\u4ee5\u5728\u7f16\u8bd1\u671f\u5141\u8bb8\u7b80\u5316\uff0c\u56e0\u6b64\u5e76\u975e\u6240\u6709\u7684\u5185\u8054\u51fd\u6570\u4ee3\u7801\u90fd\u9700\u8981\u88ab\u5305\u542b\u8fdb\u53bb\u3002\u4ee3\u7801\u5927\u5c0f\u7684\u5f71\u54cd\u662f\u4e0d\u53ef\u9884\u6d4b\u7684\uff0c\u8fd9\u53d6\u51b3\u4e8e\u7279\u5b9a\u7684\u60c5\u51b5\u3002\u4e3a\u4e86\u58f0\u660e\u4e00\u4e2a\u5185\u8054\u51fd\u6570\uff0c\u6211\u4eec\u5fc5\u987b\u5728\u51fd\u6570\u58f0\u660e\u4e2d\u4f7f\u7528 \"inline\" \u5173\u952e\u5b57\u3002<\/p>\n

\u73b0\u5728\u6211\u4eec\u6b63\u5904\u4e8e\u4e00\u4e2a\u731c\u6d4b\u5185\u8054\u6c47\u7f16\u5230\u5e95\u662f\u4ec0\u4e48\u7684\u70b9\u4e0a\u3002\u5b83\u53ea\u4e0d\u8fc7\u662f\u4e00\u4e9b\u5199\u4e3a\u5185\u8054\u51fd\u6570\u7684\u6c47\u7f16\u7a0b\u5e8f\u3002\u5728\u7cfb\u7edf\u7f16\u7a0b\u4e0a\uff0c\u5b83\u4eec\u65b9\u4fbf\u3001\u5feb\u901f\u5e76\u4e14\u6781\u5176\u6709\u7528\u3002\u6211\u4eec\u4e3b\u8981\u96c6\u4e2d\u5b66\u4e60\uff08GCC\uff09\u5185\u8054\u6c47\u7f16\u51fd\u6570\u7684\u57fa\u672c\u683c\u5f0f\u548c\u7528\u6cd5\u3002\u4e3a\u4e86\u58f0\u660e\u5185\u8054\u6c47\u7f16\u51fd\u6570\uff0c\u6211\u4eec\u4f7f\u7528 \"asm\" \u5173\u952e\u8bcd\u3002<\/p>\n

\u5185\u8054\u6c47\u7f16\u4e4b\u6240\u4ee5\u91cd\u8981\uff0c\u4e3b\u8981\u662f\u56e0\u4e3a\u5b83\u53ef\u4ee5\u64cd\u4f5c\u5e76\u4e14\u4f7f\u5176\u8f93\u51fa\u901a\u8fc7 C \u53d8\u91cf\u663e\u793a\u51fa\u6765\u3002\u6b63\u662f\u56e0\u4e3a\u6b64\u80fd\u529b\uff0c \"asm\" \u53ef\u4ee5\u7528\u4f5c\u6c47\u7f16\u6307\u4ee4\u548c\u5305\u542b\u5b83\u7684 C \u7a0b\u5e8f\u4e4b\u95f4\u7684\u63a5\u53e3\u3002<\/p>\n

3. GCC \u6c47\u7f16\u8bed\u6cd5<\/strong><\/div>\n

\"gnu-gcc02\"<\/p>\n

Linux\u4e0a\u7684 GNU C \u7f16\u8bd1\u5668 GCC \uff0c\u4f7f\u7528 AT&T<\/strong> \/ UNIX<\/strong> \u6c47\u7f16\u8bed\u6cd5\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 AT&T \u8bed\u6cd5 \u8fdb\u884c\u6c47\u7f16\u7f16\u7801\u3002\u5982\u679c\u4f60\u5bf9 AT&T \u8bed\u6cd5\u4e0d\u719f\u6089\u7684\u8bdd\uff0c\u8bf7\u4e0d\u8981\u7d27\u5f20\uff0c\u6211\u4f1a\u6559\u4f60\u7684\u3002AT&T \u8bed\u6cd5\u548c Intel \u8bed\u6cd5\u7684\u5dee\u522b\u5f88\u5927\u3002\u6211\u4f1a\u7ed9\u51fa\u4e3b\u8981\u7684\u533a\u522b\u3002<\/p>\n

1.\u6e90\u64cd\u4f5c\u6570\u548c\u76ee\u7684\u64cd\u4f5c\u6570\u987a\u5e8f<\/strong><\/span><\/div>\n

AT&T \u8bed\u6cd5\u7684\u64cd\u4f5c\u6570\u65b9\u5411\u548c Intel \u8bed\u6cd5\u7684\u521a\u597d\u76f8\u53cd\u3002\u5728Intel \u8bed\u6cd5\u4e2d\uff0c\u7b2c\u4e00\u64cd\u4f5c\u6570\u4e3a\u76ee\u7684\u64cd\u4f5c\u6570\uff0c\u7b2c\u4e8c\u64cd\u4f5c\u6570\u4e3a\u6e90\u64cd\u4f5c\u6570\uff0c\u7136\u800c\u5728 AT&T \u8bed\u6cd5\u4e2d\uff0c\u7b2c\u4e00\u64cd\u4f5c\u6570\u4e3a\u6e90\u64cd\u4f5c\u6570\uff0c\u7b2c\u4e8c\u64cd\u4f5c\u6570\u4e3a\u76ee\u7684\u64cd\u4f5c\u6570\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c<\/p>\n

Intel \u8bed\u6cd5\u4e2d\u7684 \"Op-code dst src\" \u53d8\u4e3a\u00a0AT&T \u8bed\u6cd5\u4e2d\u7684 \"Op-code src dst\"\u3002<\/p>\n

2.\u5bc4\u5b58\u5668\u547d\u540d<\/strong><\/span><\/div>\n

\u5bc4\u5b58\u5668\u540d\u79f0\u6709 \"%\" \u524d\u7f00\uff0c\u5373\u5982\u679c\u5fc5\u987b\u4f7f\u7528 \"eax\"\uff0c\u5b83\u5e94\u8be5\u7528\u4f5c \"%eax\"\u3002<\/p>\n

3.\u7acb\u5373\u6570<\/strong><\/span><\/div>\n

AT&T \u7acb\u5373\u6570\u4ee5 \"$\" \u4e3a\u524d\u7f00\u3002\u9759\u6001 \"C\" \u53d8\u91cf\u4e5f\u4f7f\u7528 \"$\" \u524d\u7f00\u3002\u5728 Intel \u8bed\u6cd5\u4e2d\uff0c\u5341\u516d\u8fdb\u5236\u5e38\u91cf\u4ee5 \"h\" \u4e3a\u540e\u7f00\uff0c\u7136\u800c AT&T \u4e0d\u4f7f\u7528\u8fd9\u79cd\u8bed\u6cd5\uff0c\u8fd9\u91cc\u6211\u4eec\u7ed9\u5e38\u91cf\u6dfb\u52a0\u524d\u7f00 \"0x\"\u3002\u6240\u4ee5\uff0c\u5bf9\u4e8e\u5341\u516d\u8fdb\u5236\uff0c\u6211\u4eec\u9996\u5148\u770b\u5230\u4e00\u4e2a \"$\"\uff0c\u7136\u540e\u662f \"0x\"\uff0c\u6700\u540e\u624d\u662f\u5e38\u91cf\u3002<\/p>\n

4.\u64cd\u4f5c\u6570\u5927\u5c0f<\/strong><\/span><\/div>\n

\u5728 AT&T \u8bed\u6cd5\u4e2d\uff0c\u5b58\u50a8\u5668\u64cd\u4f5c\u6570\u7684\u5927\u5c0f\u53d6\u51b3\u4e8e\u64cd\u4f5c\u7801\u540d\u5b57\u7684\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u3002\u64cd\u4f5c\u7801\u540e\u7f00 \u2019b\u2019 \u3001\u2019w\u2019\u3001\u2019l\u2019 \u5206\u522b\u6307\u660e\u4e86\u5b57\u8282\uff088\u4f4d\uff09\u3001\u5b57\uff0816\u4f4d\uff09\u3001\u957f\u578b\uff0832\u4f4d\uff09\u5b58\u50a8\u5668\u5f15\u7528\u3002Intel \u8bed\u6cd5\u901a\u8fc7\u7ed9\u5b58\u50a8\u5668\u64cd\u4f5c\u6570\u6dfb\u52a0 \"byte ptr\"\u3001 \"word ptr\" \u548c \"dword ptr\" \u524d\u7f00\u6765\u5b9e\u73b0\u8fd9\u4e00\u529f\u80fd\u3002<\/p>\n

\u56e0\u6b64\uff0cIntel\u7684 \"mov al, byte ptr foo\" \u5728 AT&T \u8bed\u6cd5\u4e2d\u4e3a \"movb foo, %al\"\u3002<\/p>\n

5.\u5b58\u50a8\u5668\u64cd\u4f5c\u6570<\/strong><\/span><\/div>\n

\u5728 Intel \u8bed\u6cd5\u4e2d\uff0c\u57fa\u5740\u5bc4\u5b58\u5668\u5305\u542b\u5728 \"[\" \u548c \"]\" \u4e2d\uff0c\u7136\u800c\u5728 AT&T \u4e2d\uff0c\u5b83\u4eec\u53d8\u4e3a \"(\" \u548c \")\"\u3002\u53e6\u5916\uff0c\u5728 Intel \u8bed\u6cd5\u4e2d\uff0c \u95f4\u63a5\u5185\u5b58\u5f15\u7528\u4e3a<\/p>\n

\"section:[base + index*scale + disp]\"\uff0c\u5728 AT&T\u4e2d\u53d8\u4e3a \"section:disp(base, index, scale)\"\u3002<\/p>\n

\u9700\u8981\u7262\u8bb0\u7684\u4e00\u70b9\u662f\uff0c\u5f53\u4e00\u4e2a\u5e38\u91cf\u7528\u4e8e disp \u6216 scale\uff0c\u4e0d\u80fd\u6dfb\u52a0 \"$\" \u524d\u7f00\u3002<\/p>\n

\u73b0\u5728\u6211\u4eec\u770b\u5230\u4e86 Intel \u8bed\u6cd5\u548c AT&T \u8bed\u6cd5\u4e4b\u95f4\u7684\u4e00\u4e9b\u4e3b\u8981\u5dee\u522b\u3002\u6211\u4ec5\u4ec5\u5199\u4e86\u5b83\u4eec\u5dee\u522b\u7684\u4e00\u90e8\u5206\u800c\u5df2\u3002\u5173\u4e8e\u66f4\u5b8c\u6574\u7684\u4fe1\u606f\uff0c\u8bf7\u53c2\u8003 GNU \u6c47\u7f16\u6587\u6863\u3002\u73b0\u5728\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u4e00\u4e9b\u793a\u4f8b\u3002<\/p>\n

+------------------------------+------------------------------------+\r\n|       Intel Code             |      AT&T Code                     |\r\n+------------------------------+------------------------------------+\r\n| mov     eax,1                |  movl    $1,%eax                   |   \r\n| mov     ebx,0ffh             |  movl    $0xff,%ebx                |   \r\n| int     80h                  |  int     $0x80                     |   \r\n| mov     ebx, eax             |  movl    %eax, %ebx                |\r\n| mov     eax,[ecx]            |  movl    (%ecx),%eax               |\r\n| mov     eax,[ebx+3]          |  movl    3(%ebx),%eax              | \r\n| mov     eax,[ebx+20h]        |  movl    0x20(%ebx),%eax           |\r\n| add     eax,[ebx+ecx*2h]     |  addl    (%ebx,%ecx,0x2),%eax      |\r\n| lea     eax,[ebx+ecx]        |  leal    (%ebx,%ecx),%eax          |\r\n| sub     eax,[ebx+ecx*4h-20h] |  subl    -0x20(%ebx,%ecx,0x4),%eax |\r\n+------------------------------+------------------------------------+\r\n<\/pre>\n
4. \u57fa\u672c\u5185\u8054<\/strong><\/div>\n

\u57fa\u672c\u5185\u8054\u6c47\u7f16\u7684\u683c\u5f0f\u975e\u5e38\u76f4\u63a5\u4e86\u5f53\u3002\u5b83\u7684\u57fa\u672c\u683c\u5f0f\u4e3a\uff1a
\nasm(\"\u6c47\u7f16\u4ee3\u7801\");
\n\u793a\u4f8b<\/p>\n

asm(\"movl %ecx %eax\"); \/* \u5c06 ecx \u5bc4\u5b58\u5668\u7684\u5185\u5bb9\u79fb\u81f3 eax  *\/\r\n__asm__(\"movb %bh (%eax)\"); \/* \u5c06 bh \u7684\u4e00\u4e2a\u5b57\u8282\u6570\u636e \u79fb\u81f3 eax \u5bc4\u5b58\u5668\u6307\u5411\u7684\u5185\u5b58 *\/\r\n<\/pre>\n

\u4f60\u53ef\u80fd\u6ce8\u610f\u5230\u4e86\u8fd9\u91cc\u6211\u4f7f\u7528\u4e86 \"asm\" \u548c \"__asm__\"\u3002\u8fd9\u4e24\u8005\u90fd\u662f\u6709\u6548\u7684\u3002\u5982\u679c\u5173\u952e\u8bcd \"asm\" \u548c\u6211\u4eec\u7a0b\u5e8f\u7684\u4e00\u4e9b\u6807\u8bc6\u7b26\u51b2\u7a81\u4e86\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 \"__asm__\"\u3002\u5982\u679c\u6211\u4eec\u7684\u6307\u4ee4\u591a\u4e8e\u4e00\u6761\uff0c\u6211\u4eec\u53ef\u4ee5\u6bcf\u4e2a\u4e00\u884c\uff0c\u5e76\u7528\u53cc\u5f15\u53f7\u5708\u8d77\uff0c\u540c\u65f6\u4e3a\u6bcf\u6761\u6307\u4ee4\u6dfb\u52a0 \u2019\/n\u2019 \u548c \u2019\/t\u2019 \u540e\u7f00\u3002\u8fd9\u662f\u56e0\u4e3a gcc \u5c06\u6bcf\u4e00\u6761\u5f53\u4f5c\u5b57\u7b26\u4e32\u53d1\u9001\u7ed9as\uff08GAS\uff09\uff08LCTT \u8bd1\u6ce8\uff1a GAS \u5373 GNU \u6c47\u7f16\u5668\uff09\uff0c\u5e76\u4e14\u901a\u8fc7\u4f7f\u7528\u6362\u884c\u7b26\/\u5236\u8868\u7b26\u53d1\u9001\u6b63\u786e\u683c\u5f0f\u5316\u540e\u7684\u884c\u7ed9\u6c47\u7f16\u5668\u3002<\/p>\n

\u793a\u4f8b<\/p>\n

__asm__ (\"movl %eax, %ebx\/n\/t\"\r\n         \"movl $56, %esi\/n\/t\"\r\n         \"movl %ecx, $label(%edx,%ebx,$4)\/n\/t\"\r\n         \"movb %ah, (%ebx)\");\r\n<\/pre>\n

\u5982\u679c\u5728\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u6d89\u53ca\u5230\u4e00\u4e9b\u5bc4\u5b58\u5668\uff08\u5373\u6539\u53d8\u5176\u5185\u5bb9\uff09\uff0c\u4f46\u5728\u6ca1\u6709\u6062\u590d\u8fd9\u4e9b\u53d8\u5316\u7684\u60c5\u51b5\u4e0b\u4ece\u6c47\u7f16\u4e2d\u8fd4\u56de\uff0c\u8fd9\u5c06\u4f1a\u5bfc\u81f4\u4e00\u4e9b\u610f\u60f3\u4e0d\u5230\u7684\u4e8b\u60c5\u3002\u8fd9\u662f\u56e0\u4e3a GCC \u5e76\u4e0d\u77e5\u9053\u5bc4\u5b58\u5668\u5185\u5bb9\u7684\u53d8\u5316\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u95ee\u9898\uff0c\u7279\u522b\u662f\u5f53\u7f16\u8bd1\u5668\u505a\u4e86\u67d0\u4e9b\u4f18\u5316\u3002\u5728\u6ca1\u6709\u544a\u77e5 GCC \u7684\u60c5\u51b5\u4e0b\uff0c\u5b83\u5c06\u4f1a\u5047\u8bbe\u4e00\u4e9b\u5bc4\u5b58\u5668\u5b58\u50a8\u4e86\u4e00\u4e9b\u503c\u2014\u2014\u800c\u6211\u4eec\u53ef\u80fd\u5df2\u7ecf\u6539\u53d8\u5374\u6ca1\u6709\u544a\u77e5 GCC\u2014\u2014\u5b83\u4f1a\u50cf\u4ec0\u4e48\u4e8b\u90fd\u6ca1\u53d1\u751f\u4e00\u6837\u7ee7\u7eed\u8fd0\u884c\uff08LCTT \u8bd1\u6ce8\uff1a\u4ec0\u4e48\u4e8b\u90fd\u6ca1\u53d1\u751f\u4e00\u6837\u662f\u6307GCC\u4e0d\u4f1a\u5047\u8bbe\u5bc4\u5b58\u5668\u88c5\u5165\u7684\u503c\u662f\u6709\u6548\u7684\uff0c\u5f53\u9000\u51fa\u6539\u53d8\u4e86\u5bc4\u5b58\u5668\u503c\u7684\u5185\u8054\u6c47\u7f16\u540e\uff0c\u5bc4\u5b58\u5668\u7684\u503c\u4e0d\u4f1a\u4fdd\u5b58\u5230\u76f8\u5e94\u7684\u53d8\u91cf\u6216\u5185\u5b58\u7a7a\u95f4\uff09\u3002\u6211\u4eec\u6240\u53ef\u4ee5\u505a\u7684\u662f\u4f7f\u7528\u90a3\u4e9b\u6ca1\u6709\u526f\u4f5c\u7528\u7684\u6307\u4ee4\uff0c\u6216\u8005\u5f53\u6211\u4eec\u9000\u51fa\u65f6\u6062\u590d\u8fd9\u4e9b\u5bc4\u5b58\u5668\uff0c\u8981\u4e0d\u5c31\u7b49\u7740\u7a0b\u5e8f\u5d29\u6e83\u5427\u3002\u8fd9\u662f\u4e3a\u4ec0\u4e48\u6211\u4eec\u9700\u8981\u4e00\u4e9b\u6269\u5c55\u529f\u80fd\uff0c\u6269\u5c55\u6c47\u7f16\u7ed9\u6211\u4eec\u63d0\u4f9b\u4e86\u90a3\u4e9b\u529f\u80fd\u3002<\/p>\n

5. \u6269\u5c55\u6c47\u7f16<\/strong><\/div>\n

\u5728\u57fa\u672c\u5185\u8054\u6c47\u7f16\u4e2d\uff0c\u6211\u4eec\u53ea\u6709\u6307\u4ee4\u3002\u7136\u800c\u5728\u6269\u5c55\u6c47\u7f16\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u540c\u65f6\u6307\u5b9a\u64cd\u4f5c\u6570\u3002\u5b83\u5141\u8bb8\u6211\u4eec\u6307\u5b9a\u8f93\u5165\u5bc4\u5b58\u5668\u3001\u8f93\u51fa\u5bc4\u5b58\u5668\u4ee5\u53ca\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u3002GCC \u4e0d\u5f3a\u5236\u7528\u6237\u5fc5\u987b\u6307\u5b9a\u4f7f\u7528\u7684\u5bc4\u5b58\u5668\u3002\u6211\u4eec\u53ef\u4ee5\u628a\u5934\u75bc\u7684\u4e8b\u7559\u7ed9 GCC \uff0c\u8fd9\u53ef\u80fd\u53ef\u4ee5\u66f4\u597d\u5730\u9002\u5e94 GCC \u7684\u4f18\u5316\u3002\u4e0d\u7ba1\u600e\u4e48\u8bf4\uff0c\u57fa\u672c\u683c\u5f0f\u4e3a\uff1a
\nasm ( \u6c47\u7f16\u7a0b\u5e8f\u6a21\u677f
\n: \u8f93\u51fa\u64cd\u4f5c\u6570 \/* \u53ef\u9009\u7684 *\/
\n: \u8f93\u5165\u64cd\u4f5c\u6570 \/* \u53ef\u9009\u7684 *\/
\n: \u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868 \/* \u53ef\u9009\u7684 *\/
\n);<\/p>\n

\u6c47\u7f16\u7a0b\u5e8f\u6a21\u677f\u7531\u6c47\u7f16\u6307\u4ee4\u7ec4\u6210\u3002\u6bcf\u4e00\u4e2a\u64cd\u4f5c\u6570\u7531\u4e00\u4e2a\u64cd\u4f5c\u6570\u7ea6\u675f\u5b57\u7b26\u4e32\u6240\u63cf\u8ff0\uff0c\u5176\u540e\u7d27\u63a5\u4e00\u4e2a\u62ec\u5f27\u62ec\u8d77\u7684 C \u8868\u8fbe\u5f0f\u3002\u5192\u53f7\u7528\u4e8e\u5c06\u6c47\u7f16\u7a0b\u5e8f\u6a21\u677f\u548c\u7b2c\u4e00\u4e2a\u8f93\u51fa\u64cd\u4f5c\u6570\u5206\u5f00\uff0c\u53e6\u4e00\u4e2a\uff08\u5192\u53f7\uff09\u7528\u4e8e\u5c06\u6700\u540e\u4e00\u4e2a\u8f93\u51fa\u64cd\u4f5c\u6570\u548c\u7b2c\u4e00\u4e2a\u8f93\u5165\u64cd\u4f5c\u6570\u5206\u5f00\uff08\u5982\u679c\u5b58\u5728\u7684\u8bdd\uff09\u3002\u9017\u53f7\u7528\u4e8e\u5206\u79bb\u6bcf\u4e00\u4e2a\u7ec4\u5185\u7684\u64cd\u4f5c\u6570\u3002\u603b\u64cd\u4f5c\u6570\u7684\u6570\u76ee\u9650\u5236\u5728 10 \u4e2a\uff0c\u6216\u8005\u673a\u5668\u63cf\u8ff0\u4e2d\u7684\u4efb\u4f55\u6307\u4ee4\u683c\u5f0f\u4e2d\u7684\u6700\u5927\u64cd\u4f5c\u6570\u6570\u76ee\uff0c\u4ee5\u8f83\u5927\u8005\u4e3a\u51c6\u3002<\/p>\n

\"linux-hb\"<\/p>\n

\u5982\u679c\u6ca1\u6709\u8f93\u51fa\u64cd\u4f5c\u6570\u4f46\u5b58\u5728\u8f93\u5165\u64cd\u4f5c\u6570\uff0c\u4f60\u5fc5\u987b\u5c06\u4e24\u4e2a\u8fde\u7eed\u7684\u5192\u53f7\u653e\u7f6e\u4e8e\u8f93\u51fa\u64cd\u4f5c\u6570\u539f\u672c\u4f1a\u653e\u7f6e\u7684\u5730\u65b9\u5468\u56f4\u3002<\/p>\n

\u793a\u4f8b\uff1a<\/p>\n

asm (\"cld\/n\/t\"\r\n     \"rep\/n\/t\"\r\n     \"stosl\"\r\n     : \/* \u65e0\u8f93\u51fa\u5bc4\u5b58\u5668 *\/\r\n     : \"c\" (count), \"a\" (fill_value), \"D\" (dest)\r\n     : \"%ecx\", \"%edi\" \r\n     );\r\n<\/pre>\n

\u73b0\u5728\u6765\u770b\u770b\u8fd9\u6bb5\u4ee3\u7801\u662f\u5e72\u4ec0\u4e48\u7684\uff1f\u4ee5\u4e0a\u7684\u5185\u8054\u6c47\u7f16\u662f\u5c06 \"fill_value\" \u503c\u8fde\u7eed \"count\" \u6b21\u62f7\u8d1d\u5230\u5bc4\u5b58\u5668 \"edi\" \u6240\u6307\u4f4d\u7f6e\uff08LCTT \u8bd1\u6ce8\uff1a\u6bcf\u6267\u884c stosl \u4e00\u6b21\uff0c\u5bc4\u5b58\u5668 edi \u7684\u503c\u4f1a\u9012\u589e\u6216\u9012\u51cf\uff0c\u8fd9\u53d6\u51b3\u4e8e\u662f\u5426\u8bbe\u7f6e\u4e86 direction \u6807\u5fd7\uff0c\u56e0\u6b64\u4ee5\u4e0a\u4ee3\u7801\u5b9e\u5219\u521d\u59cb\u5316\u4e00\u4e2a\u5185\u5b58\u5757\uff09\u3002 \u5b83\u4e5f\u544a\u8bc9 gcc \u5bc4\u5b58\u5668 \"ecx\" \u548c \"edi\" \u4e00\u76f4\u65e0\u6548\u3002\u4e3a\u4e86\u66f4\u52a0\u6e05\u6670\u5730\u8bf4\u660e\uff0c\u8ba9\u6211\u4eec\u518d\u770b\u4e00\u4e2a\u793a\u4f8b\u3002<\/p>\n

int a=10, b;\r\nasm (\"movl %1, %%eax; \r\n      movl %%eax, %0;\"\r\n     :\"=r\"(b)        \/* \u8f93\u51fa *\/\r\n     :\"r\"(a)         \/* \u8f93\u5165 *\/\r\n     :\"%eax\"         \/* \u4fee\u9970\u5bc4\u5b58\u5668 *\/\r\n     );       \r\n<\/pre>\n

\u8fd9\u91cc\u6211\u4eec\u6240\u505a\u7684\u662f\u4f7f\u7528\u6c47\u7f16\u6307\u4ee4\u4f7f \u2019b\u2019 \u53d8\u91cf\u7684\u503c\u7b49\u4e8e \u2019a\u2019 \u53d8\u91cf\u7684\u503c\u3002\u4e00\u4e9b\u6709\u610f\u601d\u7684\u5730\u65b9\u662f\uff1a<\/p>\n

    \n
  1. \"b\" \u4e3a\u8f93\u51fa\u64cd\u4f5c\u6570\uff0c\u7528 %0 \u5f15\u7528\uff0c\u5e76\u4e14 \"a\" \u4e3a\u8f93\u5165\u64cd\u4f5c\u6570\uff0c\u7528 %1 \u5f15\u7528\u3002<\/li>\n
  2. \"r\" \u4e3a\u64cd\u4f5c\u6570\u7ea6\u675f\u3002\u4e4b\u540e\u6211\u4eec\u4f1a\u66f4\u8be6\u7ec6\u5730\u4e86\u89e3\u7ea6\u675f\uff08\u5b57\u7b26\u4e32\uff09\u3002\u76ee\u524d\uff0c\"r\" \u544a\u8bc9 GCC \u53ef\u4ee5\u4f7f\u7528\u4efb\u4e00\u5bc4\u5b58\u5668\u5b58\u50a8\u64cd\u4f5c\u6570\u3002\u8f93\u51fa\u64cd\u4f5c\u6570\u7ea6\u675f\u5e94\u8be5\u6709\u4e00\u4e2a\u7ea6\u675f\u4fee\u9970\u7b26 \"=\" \u3002\u8fd9\u4fee\u9970\u7b26\u8868\u660e\u5b83\u662f\u4e00\u4e2a\u53ea\u8bfb\u7684\u8f93\u51fa\u64cd\u4f5c\u6570\u3002<\/li>\n
  3. \u5bc4\u5b58\u5668\u540d\u5b57\u4ee5\u4e24\u4e2a % \u4e3a\u524d\u7f00\u3002\u8fd9\u6709\u5229\u4e8e GCC \u533a\u5206\u64cd\u4f5c\u6570\u548c\u5bc4\u5b58\u5668\u3002\u64cd\u4f5c\u6570\u4ee5\u4e00\u4e2a % \u4e3a\u524d\u7f00\u3002<\/li>\n
  4. \u7b2c\u4e09\u4e2a\u5192\u53f7\u4e4b\u540e\u7684\u4fee\u9970\u5bc4\u5b58\u5668 %eax \u7528\u4e8e\u544a\u8bc9 GCC %eax \u7684\u503c\u5c06\u4f1a\u5728 \"asm\" \u5185\u90e8\u88ab\u4fee\u6539\uff0c\u6240\u4ee5 GCC \u5c06\u4e0d\u4f1a\u4f7f\u7528\u6b64\u5bc4\u5b58\u5668\u5b58\u50a8\u4efb\u4f55\u5176\u4ed6\u503c\u3002<\/li>\n<\/ol>\n

    \u5f53 \u201casm\u201d \u6267\u884c\u5b8c\u6bd5\uff0c \"b\" \u53d8\u91cf\u4f1a\u6620\u5c04\u5230\u66f4\u65b0\u7684\u503c\uff0c\u56e0\u4e3a\u5b83\u88ab\u6307\u5b9a\u4e3a\u8f93\u51fa\u64cd\u4f5c\u6570\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c \u201casm\u201d \u5185 \"b\" \u53d8\u91cf\u7684\u4fee\u6539\u5e94\u8be5\u4f1a\u88ab\u6620\u5c04\u5230 \u201casm\u201d \u5916\u90e8\u3002<\/p>\n

    \u73b0\u5728\uff0c\u6211\u4eec\u53ef\u4ee5\u66f4\u8be6\u7ec6\u5730\u770b\u770b\u6bcf\u4e00\u4e2a\u57df\u3002<\/p>\n

    1.\u6c47\u7f16\u7a0b\u5e8f\u6a21\u677f<\/strong><\/span><\/div>\n

    \u6c47\u7f16\u7a0b\u5e8f\u6a21\u677f\u5305\u542b\u4e86\u88ab\u63d2\u5165\u5230 C \u7a0b\u5e8f\u7684\u6c47\u7f16\u6307\u4ee4\u96c6\u3002\u5176\u683c\u5f0f\u4e3a\uff1a\u6bcf\u6761\u6307\u4ee4\u7528\u53cc\u5f15\u53f7\u5708\u8d77\uff0c\u6216\u8005\u6574\u4e2a\u6307\u4ee4\u7ec4\u7528\u53cc\u5f15\u53f7\u5708\u8d77\u3002\u540c\u65f6\u6bcf\u6761\u6307\u4ee4\u5e94\u4ee5\u5206\u754c\u7b26\u7ed3\u5c3e\u3002\u6709\u6548\u7684\u5206\u754c\u7b26\u6709\u6362\u884c\u7b26\uff08\"\/n\"\uff09\u548c\u5206\u53f7\uff08\";\"\uff09\u3002\"\/n\" \u53ef\u4ee5\u7d27\u968f\u4e00\u4e2a\u5236\u8868\u7b26\uff08\"\/t\"\uff09\u3002\u6211\u4eec\u5e94\u8be5\u90fd\u660e\u767d\u4f7f\u7528\u6362\u884c\u7b26\u6216\u5236\u8868\u7b26\u7684\u539f\u56e0\u4e86\u5427\uff08LCTT \u8bd1\u6ce8\uff1a\u5c31\u662f\u4e3a\u4e86\u6392\u7248\u548c\u5206\u9694\uff09\uff1f\u548c C \u8868\u8fbe\u5f0f\u5bf9\u5e94\u7684\u64cd\u4f5c\u6570\u4f7f\u7528 %0\u3001%1 ... \u7b49\u7b49\u8868\u793a\u3002<\/p>\n

    2.\u64cd\u4f5c\u6570<\/strong><\/span><\/div>\n

    C \u8868\u8fbe\u5f0f\u7528\u4f5c \u201casm\u201d \u5185\u7684\u6c47\u7f16\u6307\u4ee4\u64cd\u4f5c\u6570\u3002\u6bcf\u4e2a\u64cd\u4f5c\u6570\u524d\u9762\u662f\u4ee5\u53cc\u5f15\u53f7\u5708\u8d77\u7684\u64cd\u4f5c\u6570\u7ea6\u675f\u3002\u5bf9\u4e8e\u8f93\u51fa\u64cd\u4f5c\u6570\uff0c\u5728\u5f15\u53f7\u5185\u8fd8\u6709\u4e00\u4e2a\u7ea6\u675f\u4fee\u9970\u7b26\uff0c\u5176\u540e\u7d27\u968f\u4e00\u4e2a\u7528\u4e8e\u8868\u793a\u64cd\u4f5c\u6570\u7684 C \u8868\u8fbe\u5f0f\u3002\u5373\uff0c\u201c\u64cd\u4f5c\u6570\u7ea6\u675f\u201d\uff08C \u8868\u8fbe\u5f0f\uff09\u662f\u4e00\u4e2a\u901a\u7528\u683c\u5f0f\u3002\u5bf9\u4e8e\u8f93\u51fa\u64cd\u4f5c\u6570\uff0c\u8fd8\u6709\u4e00\u4e2a\u989d\u5916\u7684\u4fee\u9970\u7b26\u3002\u7ea6\u675f\u5b57\u7b26\u4e32\u4e3b\u8981\u7528\u4e8e\u51b3\u5b9a\u64cd\u4f5c\u6570\u7684\u5bfb\u5740\u65b9\u5f0f\uff0c\u540c\u65f6\u4e5f\u7528\u4e8e\u6307\u5b9a\u4f7f\u7528\u7684\u5bc4\u5b58\u5668\u3002<\/p>\n

    \u5982\u679c\u6211\u4eec\u4f7f\u7528\u7684\u64cd\u4f5c\u6570\u591a\u4e8e\u4e00\u4e2a\uff0c\u90a3\u4e48\u6bcf\u4e00\u4e2a\u64cd\u4f5c\u6570\u7528\u9017\u53f7\u9694\u5f00\u3002<\/p>\n

    \u5728\u6c47\u7f16\u7a0b\u5e8f\u6a21\u677f\u4e2d\uff0c\u6bcf\u4e2a\u64cd\u4f5c\u6570\u7528\u6570\u5b57\u5f15\u7528\u3002\u7f16\u53f7\u65b9\u5f0f\u5982\u4e0b\u3002\u5982\u679c\u603b\u5171\u6709 n \u4e2a\u64cd\u4f5c\u6570\uff08\u5305\u62ec\u8f93\u5165\u548c\u8f93\u51fa\u64cd\u4f5c\u6570\uff09\uff0c\u90a3\u4e48\u7b2c\u4e00\u4e2a\u8f93\u51fa\u64cd\u4f5c\u6570\u7f16\u53f7\u4e3a 0 \uff0c\u9010\u9879\u9012\u589e\uff0c\u5e76\u4e14\u6700\u540e\u4e00\u4e2a\u8f93\u5165\u64cd\u4f5c\u6570\u7f16\u53f7\u4e3a n - 1 \u3002\u64cd\u4f5c\u6570\u7684\u6700\u5927\u6570\u76ee\u5728\u524d\u4e00\u8282\u6211\u4eec\u8bb2\u8fc7\u3002<\/p>\n

    \u8f93\u51fa\u64cd\u4f5c\u6570\u8868\u8fbe\u5f0f\u5fc5\u987b\u4e3a\u5de6\u503c\u3002\u8f93\u5165\u64cd\u4f5c\u6570\u7684\u8981\u6c42\u4e0d\u50cf\u8fd9\u6837\u4e25\u683c\u3002\u5b83\u4eec\u53ef\u4ee5\u4e3a\u8868\u8fbe\u5f0f\u3002\u6269\u5c55\u6c47\u7f16\u7279\u6027\u5e38\u5e38\u7528\u4e8e\u7f16\u8bd1\u5668\u6240\u4e0d\u77e5\u9053\u7684\u673a\u5668\u6307\u4ee4 ;-)\u3002\u5982\u679c\u8f93\u51fa\u8868\u8fbe\u5f0f\u65e0\u6cd5\u76f4\u63a5\u5bfb\u5740\uff08\u5373\uff0c\u5b83\u662f\u4e00\u4e2a\u4f4d\u57df\uff09\uff0c\u6211\u4eec\u7684\u7ea6\u675f\u5b57\u7b26\u4e32\u5fc5\u987b\u7ed9\u5b9a\u4e00\u4e2a\u5bc4\u5b58\u5668\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cGCC \u5c06\u4f1a\u4f7f\u7528\u8be5\u5bc4\u5b58\u5668\u4f5c\u4e3a\u6c47\u7f16\u7684\u8f93\u51fa\uff0c\u7136\u540e\u5b58\u50a8\u8be5\u5bc4\u5b58\u5668\u7684\u5185\u5bb9\u5230\u8f93\u51fa\u3002<\/p>\n

    \u6b63\u5982\u524d\u9762\u6240\u9648\u8ff0\u7684\u4e00\u6837\uff0c\u666e\u901a\u7684\u8f93\u51fa\u64cd\u4f5c\u6570\u5fc5\u987b\u4e3a\u53ea\u5199\u7684\uff1b GCC \u5c06\u4f1a\u5047\u8bbe\u6307\u4ee4\u524d\u7684\u64cd\u4f5c\u6570\u503c\u662f\u6b7b\u7684\uff0c\u5e76\u4e14\u4e0d\u9700\u8981\u88ab\uff08\u63d0\u524d\uff09\u751f\u6210\u3002\u6269\u5c55\u6c47\u7f16\u4e5f\u652f\u6301\u8f93\u5165-\u8f93\u51fa\u6216\u8005\u8bfb-\u5199\u64cd\u4f5c\u6570\u3002<\/p>\n

    \u6240\u4ee5\u73b0\u5728\u6211\u4eec\u6765\u5173\u6ce8\u4e00\u4e9b\u793a\u4f8b\u3002\u6211\u4eec\u60f3\u8981\u6c42\u4e00\u4e2a\u6570\u76845\u6b21\u65b9\u7ed3\u679c\u3002\u4e3a\u4e86\u8ba1\u7b97\u8be5\u503c\uff0c\u6211\u4eec\u4f7f\u7528 \"lea\" \u6307\u4ee4\u3002<\/p>\n

    asm (\"leal (%1,%1,4), %0\"\r\n     : \"=r\" (five_times_x)\r\n     : \"r\" (x) \r\n     );\r\n<\/pre>\n

    \u8fd9\u91cc\u6211\u4eec\u7684\u8f93\u5165\u4e3a x\u3002\u6211\u4eec\u4e0d\u6307\u5b9a\u4f7f\u7528\u7684\u5bc4\u5b58\u5668\u3002 GCC \u5c06\u4f1a\u9009\u62e9\u4e00\u4e9b\u8f93\u5165\u5bc4\u5b58\u5668\uff0c\u4e00\u4e2a\u8f93\u51fa\u5bc4\u5b58\u5668\uff0c\u6765\u505a\u6211\u4eec\u9884\u671f\u7684\u5de5\u4f5c\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u8f93\u5165\u548c\u8f93\u51fa\u653e\u5728\u540c\u4e00\u4e2a\u5bc4\u5b58\u5668\u91cc\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u8981\u6c42 GCC \u8fd9\u6837\u505a\u3002\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528\u90a3\u4e9b\u8bfb-\u5199\u64cd\u4f5c\u6570\u7c7b\u578b\u3002\u8fd9\u91cc\u6211\u4eec\u901a\u8fc7\u6307\u5b9a\u5408\u9002\u7684\u7ea6\u675f\u6765\u5b9e\u73b0\u5b83\u3002<\/p>\n

    asm (\"leal (%0,%0,4), %0\"\r\n     : \"=r\" (five_times_x)\r\n     : \"0\" (x) \r\n     );\r\n<\/pre>\n

    \u73b0\u5728\u8f93\u51fa\u548c\u8f93\u51fa\u64cd\u4f5c\u6570\u4f4d\u4e8e\u540c\u4e00\u4e2a\u5bc4\u5b58\u5668\u3002\u4f46\u662f\u6211\u4eec\u65e0\u6cd5\u5f97\u77e5\u662f\u54ea\u4e00\u4e2a\u5bc4\u5b58\u5668\u3002\u73b0\u5728\u5047\u5982\u6211\u4eec\u4e5f\u60f3\u8981\u6307\u5b9a\u64cd\u4f5c\u6570\u6240\u5728\u7684\u5bc4\u5b58\u5668\uff0c\u8fd9\u91cc\u6709\u4e00\u79cd\u65b9\u6cd5\u3002<\/p>\n

    asm (\"leal (%%ecx,%%ecx,4), %%ecx\"\r\n     : \"=c\" (x)\r\n     : \"c\" (x) \r\n     );\r\n<\/pre>\n

    \u5728\u4ee5\u4e0a\u4e09\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5e76\u6ca1\u6709\u5728\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u91cc\u6dfb\u52a0\u4efb\u4f55\u5bc4\u5b58\u5668\uff0c\u4e3a\u4ec0\u4e48\uff1f\u5728\u5934\u4e24\u4e2a\u793a\u4f8b\uff0c GCC \u51b3\u5b9a\u4e86\u5bc4\u5b58\u5668\u5e76\u4e14\u5b83\u77e5\u9053\u53d1\u751f\u4e86\u4ec0\u4e48\u6539\u53d8\u3002\u5728\u6700\u540e\u4e00\u4e2a\u793a\u4f8b\uff0c\u6211\u4eec\u4e0d\u5fc5\u5c06 'ecx' \u6dfb\u52a0\u5230\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\uff08LCTT \u8bd1\u6ce8\uff1a \u539f\u6587\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u8fd9\u4e2a\u5355\u8bcd\u62fc\u5199\u6709\u9519\uff0c\u8fd9\u91cc\u5df2\u4fee\u6b63\uff09\uff0cgcc \u77e5\u9053\u5b83\u8868\u793a x\u3002\u56e0\u6b64\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u77e5\u9053 \"ecx\" \u7684\u503c\uff0c\u5b83\u5c31\u4e0d\u88ab\u5f53\u4f5c\u4fee\u9970\u7684\uff08\u5bc4\u5b58\u5668\uff09\u4e86\u3002<\/p>\n

    3.\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868<\/strong><\/span><\/div>\n

    \u4e00\u4e9b\u6307\u4ee4\u4f1a\u7834\u574f\u4e00\u4e9b\u786c\u4ef6\u5bc4\u5b58\u5668\u5185\u5bb9\u3002\u6211\u4eec\u4e0d\u5f97\u4e0d\u5728\u4fee\u9970\u5bc4\u5b58\u5668\u4e2d\u5217\u51fa\u8fd9\u4e9b\u5bc4\u5b58\u5668\uff0c\u5373\u6c47\u7f16\u51fd\u6570\u5185\u7b2c\u4e09\u4e2a \u2019:<\/strong>\u2019 \u4e4b\u540e\u7684\u57df\u3002\u8fd9\u53ef\u4ee5\u901a\u77e5 gcc \u6211\u4eec\u5c06\u4f1a\u81ea\u5df1\u4f7f\u7528\u548c\u4fee\u6539\u8fd9\u4e9b\u5bc4\u5b58\u5668\uff0c\u8fd9\u6837 gcc \u5c31\u4e0d\u4f1a\u5047\u8bbe\u5b58\u5165\u8fd9\u4e9b\u5bc4\u5b58\u5668\u7684\u503c\u662f\u6709\u6548\u7684\u3002\u6211\u4eec\u4e0d\u7528\u5728\u8fd9\u4e2a\u5217\u8868\u91cc\u5217\u51fa\u8f93\u5165\u3001\u8f93\u51fa\u5bc4\u5b58\u5668\u3002\u56e0\u4e3a gcc \u77e5\u9053 \u201casm\u201d \u4f7f\u7528\u4e86\u5b83\u4eec\uff08\u56e0\u4e3a\u5b83\u4eec\u88ab\u663e\u5f0f\u5730\u6307\u5b9a\u4e3a\u7ea6\u675f\u4e86\uff09\u3002\u5982\u679c\u6307\u4ee4\u9690\u5f0f\u6216\u663e\u5f0f\u5730\u4f7f\u7528\u4e86\u4efb\u4f55\u5176\u4ed6\u5bc4\u5b58\u5668\uff0c\uff08\u5e76\u4e14\u5bc4\u5b58\u5668\u6ca1\u6709\u51fa\u73b0\u5728\u8f93\u51fa\u6216\u8005\u8f93\u51fa\u7ea6\u675f\u5217\u8868\u91cc\uff09\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u5728\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u4e2d\u6307\u5b9a\u8fd9\u4e9b\u5bc4\u5b58\u5668\u3002<\/p>\n

    \u5982\u679c\u6211\u4eec\u7684\u6307\u4ee4\u53ef\u4ee5\u4fee\u6539\u6761\u4ef6\u7801\u5bc4\u5b58\u5668\uff08cc\uff09\uff0c\u6211\u4eec\u5fc5\u987b\u5c06 \"cc\" \u6dfb\u52a0\u8fdb\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u3002<\/p>\n

    \u5982\u679c\u6211\u4eec\u7684\u6307\u4ee4\u4ee5\u4e0d\u53ef\u9884\u6d4b\u7684\u65b9\u5f0f\u4fee\u6539\u4e86\u5185\u5b58\uff0c\u90a3\u4e48\u9700\u8981\u5c06 \"memory\" \u6dfb\u52a0\u8fdb\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u3002\u8fd9\u53ef\u4ee5\u4f7f GCC \u4e0d\u4f1a\u5728\u6c47\u7f16\u6307\u4ee4\u95f4\u4fdd\u6301\u7f13\u5b58\u4e8e\u5bc4\u5b58\u5668\u7684\u5185\u5b58\u503c\u3002\u5982\u679c\u88ab\u5f71\u54cd\u7684\u5185\u5b58\u4e0d\u5728\u6c47\u7f16\u7684\u8f93\u5165\u6216\u8f93\u51fa\u5217\u8868\u4e2d\uff0c\u6211\u4eec\u4e5f\u5fc5\u987b\u6dfb\u52a0 \"volatile\" \u5173\u952e\u8bcd\u3002<\/p>\n

    \u6211\u4eec\u53ef\u4ee5\u6309\u6211\u4eec\u7684\u9700\u6c42\u591a\u6b21\u8bfb\u5199\u4fee\u9970\u5bc4\u5b58\u5668\u3002\u53c2\u8003\u4e00\u4e0b\u6a21\u677f\u5185\u7684\u591a\u6307\u4ee4\u793a\u4f8b\uff1b\u5b83\u5047\u8bbe\u5b50\u4f8b\u7a0b _foo \u63a5\u53d7\u5bc4\u5b58\u5668 \"eax\" \u548c \"ecx\" \u91cc\u7684\u53c2\u6570\u3002<\/p>\n

    asm (\"movl %0,%%eax;\r\n      movl %1,%%ecx;\r\n      call _foo\"\r\n     : \/* no outputs *\/\r\n     : \"g\" (from), \"g\" (to)\r\n     : \"eax\", \"ecx\"\r\n     );\r\n<\/pre>\n
    4.Volatile ...?<\/strong><\/span><\/div>\n

    \u5982\u679c\u4f60\u719f\u6089\u5185\u6838\u6e90\u7801\u6216\u8005\u7c7b\u4f3c\u6f02\u4eae\u7684\u4ee3\u7801\uff0c\u4f60\u4e00\u5b9a\u89c1\u8fc7\u8bb8\u591a\u58f0\u660e\u4e3a \"volatile\" \u6216\u8005 \"__volatile__\"\u7684\u51fd\u6570\uff0c\u5176\u8ddf\u7740\u4e00\u4e2a \"asm\" \u6216\u8005 \"__asm__\"\u3002\u6211\u4e4b\u524d\u63d0\u5230\u8fc7\u5173\u952e\u8bcd \"asm\" \u548c \"__asm__\"\u3002\u90a3\u4e48\u4ec0\u4e48\u662f \"volatile\" \u5462\uff1f<\/p>\n

    \u5982\u679c\u6211\u4eec\u7684\u6c47\u7f16\u8bed\u53e5\u5fc5\u987b\u5728\u6211\u4eec\u653e\u7f6e\u5b83\u7684\u5730\u65b9\u6267\u884c\uff08\u4f8b\u5982\uff0c\u4e0d\u80fd\u4e3a\u4e86\u4f18\u5316\u800c\u88ab\u79fb\u51fa\u5faa\u73af\u8bed\u53e5\uff09\uff0c\u5c06\u5173\u952e\u8bcd \"volatile\" \u653e\u7f6e\u5728 asm \u540e\u9762\u3001()\u7684\u524d\u9762\u3002\u4ee5\u9632\u6b62\u5b83\u88ab\u79fb\u52a8\u3001\u5220\u9664\u6216\u8005\u5176\u4ed6\u64cd\u4f5c\uff0c\u6211\u4eec\u5c06\u5176\u58f0\u660e\u4e3a \"asm volatile ( ... : ... : ... : ...);\"<\/p>\n

    \u5982\u679c\u62c5\u5fc3\u53d1\u751f\u51b2\u7a81\uff0c\u8bf7\u4f7f\u7528 \"__volatile__\"\u3002<\/p>\n

    \u5982\u679c\u6211\u4eec\u7684\u6c47\u7f16\u53ea\u662f\u7528\u4e8e\u4e00\u4e9b\u8ba1\u7b97\u5e76\u4e14\u6ca1\u6709\u4efb\u4f55\u526f\u4f5c\u7528\uff0c\u4e0d\u4f7f\u7528 \"volatile\" \u5173\u952e\u8bcd\u4f1a\u66f4\u597d\u3002\u4e0d\u4f7f\u7528 \"volatile\" \u53ef\u4ee5\u5e2e\u52a9 gcc \u4f18\u5316\u4ee3\u7801\u5e76\u4f7f\u4ee3\u7801\u66f4\u6f02\u4eae\u3002<\/p>\n

    \u5728\u201c\u4e00\u4e9b\u5b9e\u7528\u7684\u8bc0\u7a8d\u201d\u4e00\u8282\u4e2d\uff0c\u6211\u63d0\u4f9b\u4e86\u591a\u4e2a\u5185\u8054\u6c47\u7f16\u51fd\u6570\u7684\u4f8b\u5b50\u3002\u90a3\u91cc\u6211\u4eec\u53ef\u4ee5\u4e86\u89e3\u5230\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u7684\u7ec6\u8282\u3002<\/p>\n

    6. \u66f4\u591a\u5173\u4e8e\u7ea6\u675f<\/strong><\/div>\n

    \u5230\u8fd9\u4e2a\u65f6\u5019\uff0c\u4f60\u53ef\u80fd\u5df2\u7ecf\u4e86\u89e3\u5230\u7ea6\u675f\u548c\u5185\u8054\u6c47\u7f16\u6709\u5f88\u5927\u7684\u5173\u8054\u3002\u4f46\u6211\u4eec\u5bf9\u7ea6\u675f\u8bb2\u7684\u8fd8\u4e0d\u591a\u3002\u7ea6\u675f\u7528\u4e8e\u8868\u660e\u4e00\u4e2a\u64cd\u4f5c\u6570\u662f\u5426\u53ef\u4ee5\u4f4d\u4e8e\u5bc4\u5b58\u5668\u548c\u4f4d\u4e8e\u54ea\u79cd\u5bc4\u5b58\u5668\uff1b\u64cd\u4f5c\u6570\u662f\u5426\u53ef\u4ee5\u4e3a\u4e00\u4e2a\u5185\u5b58\u5f15\u7528\u548c\u54ea\u79cd\u5730\u5740\uff1b\u64cd\u4f5c\u6570\u662f\u5426\u53ef\u4ee5\u4e3a\u4e00\u4e2a\u7acb\u5373\u6570\u548c\u5b83\u53ef\u80fd\u7684\u53d6\u503c\u8303\u56f4\uff08\u5373\u503c\u7684\u8303\u56f4\uff09\uff0c\u7b49\u7b49\u3002<\/p>\n

    6.1 \u5e38\u7528\u7ea6\u675f\/strong><\/strong><\/span><\/div>\n

    \u5728\u8bb8\u591a\u7ea6\u675f\u4e2d\uff0c\u53ea\u6709\u5c0f\u90e8\u5206\u662f\u5e38\u7528\u7684\u3002\u6211\u4eec\u6765\u770b\u770b\u8fd9\u4e9b\u7ea6\u675f\u3002
    \n1. \u5bc4\u5b58\u5668\u64cd\u4f5c\u6570\u7ea6\u675f<\/strong><\/p>\n

    \u5f53\u4f7f\u7528\u8fd9\u79cd\u7ea6\u675f\u6307\u5b9a\u64cd\u4f5c\u6570\u65f6\uff0c\u5b83\u4eec\u5b58\u50a8\u5728\u901a\u7528\u5bc4\u5b58\u5668\uff08GPR\uff09\u4e2d\u3002\u8bf7\u770b\u4e0b\u9762\u793a\u4f8b\uff1a<\/p>\n

    asm (\"movl %%eax, %0\/n\" :\"=r\"(myval));<\/pre>\n

    \u8fd9\u91cc\uff0c\u53d8\u91cf myval \u4fdd\u5b58\u5728\u5bc4\u5b58\u5668\u4e2d\uff0c\u5bc4\u5b58\u5668 eax \u7684\u503c\u88ab\u590d\u5236\u5230\u8be5\u5bc4\u5b58\u5668\u4e2d\uff0c\u5e76\u4e14 myval \u7684\u503c\u4ece\u5bc4\u5b58\u5668\u66f4\u65b0\u5230\u4e86\u5185\u5b58\u3002\u5f53\u6307\u5b9a \"r\" \u7ea6\u675f\u65f6\uff0c gcc \u53ef\u4ee5\u5c06\u53d8\u91cf\u4fdd\u5b58\u5728\u4efb\u4f55\u53ef\u7528\u7684 GPR \u4e2d\u3002\u8981\u6307\u5b9a\u5bc4\u5b58\u5668\uff0c\u4f60\u5fc5\u987b\u4f7f\u7528\u7279\u5b9a\u5bc4\u5b58\u5668\u7ea6\u675f\u76f4\u63a5\u5730\u6307\u5b9a\u5bc4\u5b58\u5668\u7684\u540d\u5b57\u3002\u5b83\u4eec\u4e3a\uff1a<\/p>\n

    +---+--------------------+\r\n| r |    Register(s)     |\r\n+---+--------------------+\r\n| a |   %eax, %ax, %al   |\r\n| b |   %ebx, %bx, %bl   |\r\n| c |   %ecx, %cx, %cl   |\r\n| d |   %edx, %dx, %dl   |\r\n| S |   %esi, %si        |\r\n| D |   %edi, %di        |\r\n+---+--------------------+\r\n<\/pre>\n

    2. \u5185\u5b58\u64cd\u4f5c\u6570\u7ea6\u675f<\/strong><\/p>\n

    \u5f53\u64cd\u4f5c\u6570\u4f4d\u4e8e\u5185\u5b58\u65f6\uff0c\u4efb\u4f55\u5bf9\u5b83\u4eec\u7684\u64cd\u4f5c\u5c06\u76f4\u63a5\u53d1\u751f\u5728\u5185\u5b58\u4f4d\u7f6e\uff0c\u8fd9\u4e0e\u5bc4\u5b58\u5668\u7ea6\u675f\u76f8\u53cd\uff0c\u540e\u8005\u9996\u5148\u5c06\u503c\u5b58\u50a8\u5728\u8981\u4fee\u6539\u7684\u5bc4\u5b58\u5668\u4e2d\uff0c\u7136\u540e\u5c06\u5b83\u5199\u56de\u5230\u5185\u5b58\u4f4d\u7f6e\u3002\u4f46\u5bc4\u5b58\u5668\u7ea6\u675f\u901a\u5e38\u7528\u4e8e\u4e00\u4e2a\u6307\u4ee4\u5fc5\u987b\u4f7f\u7528\u5b83\u4eec\u6216\u8005\u5b83\u4eec\u53ef\u4ee5\u5927\u5927\u63d0\u9ad8\u5904\u7406\u901f\u5ea6\u7684\u5730\u65b9\u3002\u5f53\u9700\u8981\u5728 \u201casm\u201d \u5185\u66f4\u65b0\u4e00\u4e2a C \u53d8\u91cf\uff0c\u800c\u53c8\u4e0d\u60f3\u4f7f\u7528\u5bc4\u5b58\u5668\u53bb\u4fdd\u5b58\u5b83\u7684\u503c\uff0c\u4f7f\u7528\u5185\u5b58\u6700\u4e3a\u6709\u6548\u3002\u4f8b\u5982\uff0cIDTR \u5bc4\u5b58\u5668\u7684\u503c\u5b58\u50a8\u4e8e\u5185\u5b58\u4f4d\u7f6e loc \u5904\uff1a<\/p>\n

    asm(\"sidt %0\/n\" : :\"m\"(loc));<\/pre>\n

    3. \u5339\u914d\uff08\u6570\u5b57\uff09\u7ea6\u675f<\/strong><\/p>\n

    \u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4e00\u4e2a\u53d8\u91cf\u53ef\u80fd\u65e2\u5145\u5f53\u8f93\u5165\u64cd\u4f5c\u6570\uff0c\u4e5f\u5145\u5f53\u8f93\u51fa\u64cd\u4f5c\u6570\u3002\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u5339\u914d\u7ea6\u675f\u5728 \"asm\" \u4e2d\u6307\u5b9a\u8fd9\u79cd\u60c5\u51b5\u3002<\/p>\n

    asm (\"incl %0\" :\"=a\"(var):\"0\"(var));<\/pre>\n

    \u5728\u64cd\u4f5c\u6570\u90a3\u4e00\u8282\u4e2d\uff0c\u6211\u4eec\u4e5f\u770b\u5230\u4e86\u4e00\u4e9b\u7c7b\u4f3c\u7684\u793a\u4f8b\u3002\u5728\u8fd9\u4e2a\u5339\u914d\u7ea6\u675f\u7684\u793a\u4f8b\u4e2d\uff0c\u5bc4\u5b58\u5668 \"%eax\" \u65e2\u7528\u4f5c\u8f93\u5165\u53d8\u91cf\uff0c\u4e5f\u7528\u4f5c\u8f93\u51fa\u53d8\u91cf\u3002 var \u8f93\u5165\u88ab\u8bfb\u8fdb %eax\uff0c\u5e76\u4e14\u7b49\u9012\u589e\u540e\u66f4\u65b0\u7684 %eax \u518d\u6b21\u88ab\u5b58\u50a8\u8fdb var\u3002\u8fd9\u91cc\u7684 \"0\" \u7528\u4e8e\u6307\u5b9a\u4e0e\u7b2c 0 \u4e2a\u8f93\u51fa\u53d8\u91cf\u76f8\u540c\u7684\u7ea6\u675f\u3002\u4e5f\u5c31\u662f\uff0c\u5b83\u6307\u5b9a var \u8f93\u51fa\u5b9e\u4f8b\u5e94\u53ea\u88ab\u5b58\u50a8\u5728 \"%eax\" \u4e2d\u3002\u8be5\u7ea6\u675f\u53ef\u7528\u4e8e\uff1a<\/p>\n

      \n
    • \u5728\u8f93\u5165\u4ece\u53d8\u91cf\u8bfb\u53d6\u6216\u53d8\u91cf\u4fee\u6539\u540e\u4e14\u4fee\u6539\u88ab\u5199\u56de\u540c\u4e00\u53d8\u91cf\u7684\u60c5\u51b5<\/li>\n
    • \u5728\u4e0d\u9700\u8981\u5c06\u8f93\u5165\u64cd\u4f5c\u6570\u5b9e\u4f8b\u548c\u8f93\u51fa\u64cd\u4f5c\u6570\u5b9e\u4f8b\u5206\u5f00\u7684\u60c5\u51b5<\/li>\n<\/ul>\n

      \u4f7f\u7528\u5339\u914d\u7ea6\u675f\u6700\u91cd\u8981\u7684\u610f\u4e49\u5728\u4e8e\u5b83\u4eec\u53ef\u4ee5\u6709\u6548\u5730\u4f7f\u7528\u53ef\u7528\u5bc4\u5b58\u5668\u3002<\/p>\n

      \u5176\u4ed6\u4e00\u4e9b\u7ea6\u675f\uff1a<\/p>\n

        \n
      1. \"m\" : \u5141\u8bb8\u4e00\u4e2a\u5185\u5b58\u64cd\u4f5c\u6570\uff0c\u53ef\u4ee5\u4f7f\u7528\u673a\u5668\u666e\u904d\u652f\u6301\u7684\u4efb\u4e00\u79cd\u5730\u5740\u3002<\/li>\n
      2. \"o\" : \u5141\u8bb8\u4e00\u4e2a\u5185\u5b58\u64cd\u4f5c\u6570\uff0c\u4f46\u53ea\u6709\u5f53\u5730\u5740\u662f\u53ef\u504f\u79fb\u7684\u3002\u5373\uff0c\u8be5\u5730\u5740\u52a0\u4e0a\u4e00\u4e2a\u5c0f\u7684\u504f\u79fb\u91cf\u53ef\u4ee5\u5f97\u5230\u4e00\u4e2a\u6709\u6548\u5730\u5740\u3002<\/li>\n
      3. \"V\" : \u4e00\u4e2a\u4e0d\u5141\u8bb8\u504f\u79fb\u7684\u5185\u5b58\u64cd\u4f5c\u6570\u3002\u6362\u8a00\u4e4b\uff0c\u4efb\u4f55\u9002\u5408 \"m\" \u7ea6\u675f\u800c\u4e0d\u9002\u5408 \"o\" \u7ea6\u675f\u7684\u64cd\u4f5c\u6570\u3002<\/li>\n
      4. \"i\" : \u5141\u8bb8\u4e00\u4e2a\uff08\u5e26\u6709\u5e38\u91cf\uff09\u7684\u7acb\u5373\u6574\u5f62\u64cd\u4f5c\u6570\u3002\u8fd9\u5305\u62ec\u5176\u503c\u4ec5\u5728\u6c47\u7f16\u65f6\u671f\u77e5\u9053\u7684\u7b26\u53f7\u5e38\u91cf\u3002<\/li>\n
      5. \"n\" : \u5141\u8bb8\u4e00\u4e2a\u5e26\u6709\u5df2\u77e5\u6570\u5b57\u7684\u7acb\u5373\u6574\u5f62\u64cd\u4f5c\u6570\u3002\u8bb8\u591a\u7cfb\u7edf\u4e0d\u652f\u6301\u6c47\u7f16\u65f6\u671f\u7684\u5e38\u91cf\uff0c\u56e0\u4e3a\u64cd\u4f5c\u6570\u5c11\u4e8e\u4e00\u4e2a\u5b57\u5bbd\u3002\u5bf9\u4e8e\u6b64\u79cd\u64cd\u4f5c\u6570\uff0c\u7ea6\u675f\u5e94\u8be5\u4f7f\u7528 'n' \u800c\u4e0d\u662f'i'\u3002<\/li>\n
      6. \"g\" : \u5141\u8bb8\u4efb\u4e00\u5bc4\u5b58\u5668\u3001\u5185\u5b58\u6216\u8005\u7acb\u5373\u6574\u5f62\u64cd\u4f5c\u6570\uff0c\u4e0d\u5305\u62ec\u901a\u7528\u5bc4\u5b58\u5668\u4e4b\u5916\u7684\u5bc4\u5b58\u5668\u3002<\/li>\n<\/ol>\n

        \u4ee5\u4e0b\u7ea6\u675f\u4e3a x86 \u7279\u6709\u3002<\/p>\n

          \n
        1. \"r\" : \u5bc4\u5b58\u5668\u64cd\u4f5c\u6570\u7ea6\u675f\uff0c\u67e5\u770b\u4e0a\u9762\u7ed9\u5b9a\u7684\u8868\u683c\u3002<\/li>\n
        2. \"q\" : \u5bc4\u5b58\u5668 a\u3001b\u3001c \u6216\u8005 d\u3002<\/li>\n
        3. \"I\" : \u8303\u56f4\u4ece 0 \u5230 31 \u7684\u5e38\u91cf\uff08\u5bf9\u4e8e 32 \u4f4d\u79fb\u4f4d\uff09\u3002<\/li>\n
        4. \"J\" : \u8303\u56f4\u4ece 0 \u5230 63 \u7684\u5e38\u91cf\uff08\u5bf9\u4e8e 64 \u4f4d\u79fb\u4f4d\uff09\u3002<\/li>\n
        5. \"K\" : 0xff\u3002<\/li>\n
        6. \"L\" : 0xffff\u3002<\/li>\n
        7. \"M\" : 0\u30011\u30012 \u6216 3 \uff08lea \u6307\u4ee4\u7684\u79fb\u4f4d\uff09\u3002<\/li>\n
        8. \"N\" : \u8303\u56f4\u4ece 0 \u5230 255 \u7684\u5e38\u91cf\uff08\u5bf9\u4e8e out \u6307\u4ee4\uff09\u3002<\/li>\n
        9. \"f\" : \u6d6e\u70b9\u5bc4\u5b58\u5668<\/li>\n
        10. \"t\" : \u7b2c\u4e00\u4e2a\uff08\u6808\u9876\uff09\u6d6e\u70b9\u5bc4\u5b58\u5668<\/li>\n
        11. \"u\" : \u7b2c\u4e8c\u4e2a\u6d6e\u70b9\u5bc4\u5b58\u5668<\/li>\n
        12. \"A\" : \u6307\u5b9a \"a\" \u6216 \"d\" \u5bc4\u5b58\u5668\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u60f3\u8981\u8fd4\u56de 64 \u4f4d\u6574\u5f62\u6570\uff0c\u4f7f\u7528 \"d\" \u5bc4\u5b58\u5668\u4fdd\u5b58\u6700\u9ad8\u6709\u6548\u4f4d\u548c \"a\" \u5bc4\u5b58\u5668\u4fdd\u5b58\u6700\u4f4e\u6709\u6548\u4f4d\u3002<\/li>\n<\/ol>\n
          6.2 \u7ea6\u675f\u4fee\u9970\u7b26<\/strong><\/span><\/div>\n

          \u5f53\u4f7f\u7528\u7ea6\u675f\u65f6\uff0c\u5bf9\u4e8e\u66f4\u7cbe\u786e\u7684\u63a7\u5236\u8d85\u8fc7\u4e86\u5bf9\u7ea6\u675f\u4f5c\u7528\u7684\u9700\u6c42\uff0cGCC \u7ed9\u6211\u4eec\u63d0\u4f9b\u4e86\u7ea6\u675f\u4fee\u9970\u7b26\u3002\u6700\u5e38\u7528\u7684\u7ea6\u675f\u4fee\u9970\u7b26\u4e3a\uff1a<\/p>\n

            \n
          1. \"=\" : \u610f\u5473\u7740\u5bf9\u4e8e\u8fd9\u6761\u6307\u4ee4\uff0c\u64cd\u4f5c\u6570\u4e3a\u53ea\u5199\u7684\uff1b\u65e7\u503c\u4f1a\u88ab\u5ffd\u7565\u5e76\u88ab\u8f93\u51fa\u6570\u636e\u6240\u66ff\u6362\u3002<\/li>\n
          2. \"&\" : \u610f\u5473\u7740\u8fd9\u4e2a\u64cd\u4f5c\u6570\u4e3a\u4e00\u4e2a\u65e9\u671f\u6539\u52a8\u7684\u64cd\u4f5c\u6570\uff0c\u5176\u5728\u8be5\u6307\u4ee4\u5b8c\u6210\u524d\u901a\u8fc7\u4f7f\u7528\u8f93\u5165\u64cd\u4f5c\u6570\u88ab\u4fee\u6539\u4e86\u3002\u56e0\u6b64\uff0c\u8fd9\u4e2a\u64cd\u4f5c\u6570\u4e0d\u53ef\u4ee5\u4f4d\u4e8e\u4e00\u4e2a\u88ab\u7528\u4f5c\u8f93\u51fa\u64cd\u4f5c\u6570\u6216\u4efb\u4f55\u5185\u5b58\u5730\u5740\u90e8\u5206\u7684\u5bc4\u5b58\u5668\u3002\u5982\u679c\u5728\u65e7\u503c\u88ab\u5199\u5165\u4e4b\u524d\u5b83\u4ec5\u7528\u4f5c\u8f93\u5165\u800c\u5df2\uff0c\u4e00\u4e2a\u8f93\u5165\u64cd\u4f5c\u6570\u53ef\u4ee5\u4e3a\u4e00\u4e2a\u65e9\u671f\u6539\u52a8\u64cd\u4f5c\u6570\u3002<\/li>\n<\/ol>\n

            \u4e0a\u8ff0\u7684\u7ea6\u675f\u5217\u8868\u548c\u89e3\u91ca\u5e76\u4e0d\u5b8c\u6574\u3002\u793a\u4f8b\u53ef\u4ee5\u8ba9\u6211\u4eec\u5bf9\u5185\u8054\u6c47\u7f16\u7684\u7528\u9014\u548c\u7528\u6cd5\u66f4\u597d\u7684\u7406\u89e3\u3002\u5728\u4e0b\u4e00\u8282\uff0c\u6211\u4eec\u4f1a\u770b\u5230\u4e00\u4e9b\u793a\u4f8b\uff0c\u5728\u90a3\u91cc\u6211\u4eec\u4f1a\u53d1\u73b0\u66f4\u591a\u5173\u4e8e\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u7684\u4e1c\u897f\u3002<\/p>\n

            7. \u4e00\u4e9b\u5b9e\u7528\u7684\u8bc0\u7a8d<\/strong><\/div>\n

            \u73b0\u5728\u6211\u4eec\u5df2\u7ecf\u4ecb\u7ecd\u4e86\u5173\u4e8e GCC \u5185\u8054\u6c47\u7f16\u7684\u57fa\u7840\u7406\u8bba\uff0c\u73b0\u5728\u6211\u4eec\u5c06\u4e13\u6ce8\u4e8e\u4e00\u4e9b\u7b80\u5355\u7684\u4f8b\u5b50\u3002\u5c06\u5185\u8054\u6c47\u7f16\u51fd\u6570\u5199\u6210\u5b8f\u7684\u5f62\u5f0f\u603b\u662f\u975e\u5e38\u65b9\u4fbf\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u5728 Linux \u5185\u6838\u4ee3\u7801\u91cc\u770b\u5230\u8bb8\u591a\u6c47\u7f16\u51fd\u6570\u3002\uff08usr\/src\/linux\/include\/asm\/*.h\uff09\u3002<\/p>\n

              \n
            1. \u9996\u5148\u6211\u4eec\u4ece\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u5165\u624b\u3002\u6211\u4eec\u5c06\u5199\u4e00\u4e2a\u4e24\u4e2a\u6570\u76f8\u52a0\u7684\u7a0b\u5e8f\u3002\n
              int main(void)\r\n{\r\n        int foo = 10, bar = 15;\r\n        __asm__ __volatile__(\"addl  %%ebx,%%eax\"\r\n                             :\"=a\"(foo)\r\n                             :\"a\"(foo), \"b\"(bar)\r\n                             );\r\n        printf(\"foo+bar=%d\/n\", foo);\r\n        return 0;\r\n}\r\n<\/pre>\n

              \u8fd9\u91cc\u6211\u4eec\u8981\u6c42 GCC \u5c06 foo \u5b58\u653e\u4e8e %eax\uff0c\u5c06 bar \u5b58\u653e\u4e8e %ebx\uff0c\u540c\u65f6\u6211\u4eec\u4e5f\u60f3\u8981\u5728 %eax \u4e2d\u5b58\u653e\u7ed3\u679c\u3002'=' \u7b26\u53f7\u8868\u793a\u5b83\u662f\u4e00\u4e2a\u8f93\u51fa\u5bc4\u5b58\u5668\u3002\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u4ee5\u5176\u4ed6\u65b9\u5f0f\u5c06\u4e00\u4e2a\u6574\u6570\u52a0\u5230\u4e00\u4e2a\u53d8\u91cf\u3002<\/p>\n

              __asm__ __volatile__(\r\n                     \"   lock       ;\/n\"\r\n                     \"   addl %1,%0 ;\/n\"\r\n                     : \"=m\"  (my_var)\r\n                     : \"ir\"  (my_int), \"m\" (my_var)\r\n                     :                                 \/* \u65e0\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868 *\/\r\n                     );\r\n<\/pre>\n

              \u8fd9\u662f\u4e00\u4e2a\u539f\u5b50\u52a0\u6cd5\u3002\u4e3a\u4e86\u79fb\u9664\u539f\u5b50\u6027\uff0c\u6211\u4eec\u53ef\u4ee5\u79fb\u9664\u6307\u4ee4 'lock'\u3002\u5728\u8f93\u51fa\u57df\u4e2d\uff0c\"=m\" \u8868\u660e myvar \u662f\u4e00\u4e2a\u8f93\u51fa\u4e14\u4f4d\u4e8e\u5185\u5b58\u3002\u7c7b\u4f3c\u5730\uff0c\"ir\" \u8868\u660e my<\/em>int \u662f\u4e00\u4e2a\u6574\u578b\uff0c\u5e76\u5e94\u8be5\u5b58\u5728\u4e8e\u5176\u4ed6\u5bc4\u5b58\u5668\uff08\u56de\u60f3\u6211\u4eec\u4e0a\u9762\u770b\u5230\u7684\u8868\u683c\uff09\u3002\u6ca1\u6709\u5bc4\u5b58\u5668\u4f4d\u4e8e\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u4e2d\u3002<\/p>\n

              \"linux-jq\"<\/li>\n

            2. \u73b0\u5728\u6211\u4eec\u5c06\u5728\u4e00\u4e9b\u5bc4\u5b58\u5668\/\u53d8\u91cf\u4e0a\u5c55\u793a\u4e00\u4e9b\u64cd\u4f5c\uff0c\u5e76\u6bd4\u8f83\u503c\u3002\n
              __asm__ __volatile__(  \"decl %0; sete %1\"\r\n                     : \"=m\" (my_var), \"=q\" (cond)\r\n                     : \"m\" (my_var) \r\n                     : \"memory\"\r\n                     );\r\n<\/pre>\n

              \u8fd9\u91cc\uff0cmy_var \u7684\u503c\u51cf 1 \uff0c\u5e76\u4e14\u5982\u679c\u7ed3\u679c\u7684\u503c\u4e3a 0\uff0c\u5219\u53d8\u91cf cond \u7f6e 1\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5c06\u6307\u4ee4 \"lock;\/n\/t\" \u6dfb\u52a0\u4e3a\u6c47\u7f16\u6a21\u677f\u7684\u7b2c\u4e00\u6761\u6307\u4ee4\u4ee5\u589e\u52a0\u539f\u5b50\u6027\u3002<\/p>\n

              \u4ee5\u7c7b\u4f3c\u7684\u65b9\u5f0f\uff0c\u4e3a\u4e86\u589e\u52a0 my_var\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 \"incl %0\" \u800c\u4e0d\u662f \"decl %0\"\u3002<\/p>\n

              \u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u5730\u65b9\u662f\uff08i\uff09my_var \u662f\u4e00\u4e2a\u5b58\u50a8\u4e8e\u5185\u5b58\u7684\u53d8\u91cf\u3002\uff08ii\uff09cond \u4f4d\u4e8e\u5bc4\u5b58\u5668 eax\u3001ebx\u3001ecx\u3001edx \u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u3002\u7ea6\u675f \"=q\" \u4fdd\u8bc1\u4e86\u8fd9\u4e00\u70b9\u3002\uff08iii\uff09\u540c\u65f6\u6211\u4eec\u53ef\u4ee5\u770b\u5230 memory \u4f4d\u4e8e\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u4e2d\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4ee3\u7801\u5c06\u6539\u53d8\u5185\u5b58\u4e2d\u7684\u5185\u5bb9\u3002<\/li>\n

            3. \u5982\u4f55\u7f6e 1 \u6216\u6e05 0 \u5bc4\u5b58\u5668\u4e2d\u7684\u4e00\u4e2a\u6bd4\u7279\u4f4d\u3002\u4f5c\u4e3a\u4e0b\u4e00\u4e2a\u8bc0\u7a8d\uff0c\u6211\u4eec\u5c06\u4f1a\u770b\u5230\u5b83\u3002\n
              __asm__ __volatile__(   \"btsl %1,%0\"\r\n                      : \"=m\" (ADDR)\r\n                      : \"Ir\" (pos)\r\n                      : \"cc\"\r\n                      );\r\n<\/pre>\n

              \u8fd9\u91cc\uff0cADDR \u53d8\u91cf\uff08\u4e00\u4e2a\u5185\u5b58\u53d8\u91cf\uff09\u7684 'pos' \u4f4d\u7f6e\u4e0a\u7684\u6bd4\u7279\u88ab\u8bbe\u7f6e\u4e3a 1\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 'btrl' \u6765\u6e05\u9664\u7531 'btsl' \u8bbe\u7f6e\u7684\u6bd4\u7279\u4f4d\u3002pos \u7684\u7ea6\u675f \"Ir\" \u8868\u660e pos \u4f4d\u4e8e\u5bc4\u5b58\u5668\uff0c\u5e76\u4e14\u5b83\u7684\u503c\u4e3a 0-31\uff08x86 \u76f8\u5173\u7ea6\u675f\uff09\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbe\u7f6e\/\u6e05\u9664 ADDR \u53d8\u91cf\u4e0a\u7b2c 0 \u5230 31 \u4f4d\u7684\u4efb\u4e00\u6bd4\u7279\u4f4d\u3002\u56e0\u4e3a\u6761\u4ef6\u7801\u4f1a\u88ab\u6539\u53d8\uff0c\u6240\u4ee5\u6211\u4eec\u5c06 \"cc\" \u6dfb\u52a0\u8fdb\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u3002<\/li>\n

            4. \u73b0\u5728\u6211\u4eec\u770b\u770b\u4e00\u4e9b\u66f4\u4e3a\u590d\u6742\u800c\u6709\u7528\u7684\u51fd\u6570\u3002\u5b57\u7b26\u4e32\u62f7\u8d1d\u3002\n
              static inline char * strcpy(char * dest,const char *src)\r\n{\r\nint d0, d1, d2;\r\n__asm__ __volatile__(  \"1:\/tlodsb\/n\/t\"\r\n                       \"stosb\/n\/t\"\r\n                       \"testb %%al,%%al\/n\/t\"\r\n                       \"jne 1b\"\r\n                     : \"=&S\" (d0), \"=&D\" (d1), \"=&a\" (d2)\r\n                     : \"0\" (src),\"1\" (dest) \r\n                     : \"memory\");\r\nreturn dest;\r\n}\r\n<\/pre>\n

              \u6e90\u5730\u5740\u5b58\u653e\u4e8e esi\uff0c\u76ee\u6807\u5730\u5740\u5b58\u653e\u4e8e edi\uff0c\u540c\u65f6\u5f00\u59cb\u62f7\u8d1d\uff0c\u5f53\u6211\u4eec\u5230\u8fbe 0<\/strong> \u65f6\uff0c\u62f7\u8d1d\u5b8c\u6210\u3002\u7ea6\u675f \"&S\"\u3001\"&D\"\u3001\"&a\" \u8868\u660e\u5bc4\u5b58\u5668 esi\u3001edi \u548c eax \u65e9\u671f\u4fee\u9970\u5bc4\u5b58\u5668\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b83\u4eec\u7684\u5185\u5bb9\u5728\u51fd\u6570\u5b8c\u6210\u524d\u4f1a\u88ab\u6539\u53d8\u3002\u8fd9\u91cc\u5f88\u660e\u663e\u53ef\u4ee5\u77e5\u9053\u4e3a\u4ec0\u4e48 \"memory\" \u4f1a\u653e\u5728\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u3002<\/p>\n

              \u6211\u4eec\u53ef\u4ee5\u770b\u5230\u4e00\u4e2a\u7c7b\u4f3c\u7684\u51fd\u6570\uff0c\u5b83\u80fd\u79fb\u52a8\u53cc\u5b57\u5757\u6570\u636e\u3002\u6ce8\u610f\u51fd\u6570\u88ab\u58f0\u660e\u4e3a\u4e00\u4e2a\u5b8f\u3002<\/p>\n

              #define mov_blk(src, dest, numwords) \/\r\n__asm__ __volatile__ (                                          \/\r\n                       \"cld\/n\/t\"                                \/\r\n                       \"rep\/n\/t\"                                \/\r\n                       \"movsl\"                                  \/\r\n                       :                                        \/\r\n                       : \"S\" (src), \"D\" (dest), \"c\" (numwords)  \/\r\n                       : \"%ecx\", \"%esi\", \"%edi\"                 \/\r\n                       )\r\n<\/pre>\n

              \u8fd9\u91cc\u6211\u4eec\u6ca1\u6709\u8f93\u51fa\uff0c\u5bc4\u5b58\u5668 ecx\u3001esi\u548c edi \u7684\u5185\u5bb9\u53d1\u751f\u4e86\u6539\u53d8\uff0c\u8fd9\u662f\u5757\u79fb\u52a8\u7684\u526f\u4f5c\u7528\u3002\u56e0\u6b64\u6211\u4eec\u5fc5\u987b\u5c06\u5b83\u4eec\u6dfb\u52a0\u8fdb\u4fee\u9970\u5bc4\u5b58\u5668\u5217\u8868\u3002<\/li>\n

            5. \u5728 Linux \u4e2d\uff0c\u7cfb\u7edf\u8c03\u7528\u4f7f\u7528 GCC \u5185\u8054\u6c47\u7f16\u5b9e\u73b0\u3002\u8ba9\u6211\u4eec\u770b\u770b\u5982\u4f55\u5b9e\u73b0\u4e00\u4e2a\u7cfb\u7edf\u8c03\u7528\u3002\u6240\u6709\u7684\u7cfb\u7edf\u8c03\u7528\u88ab\u5199\u6210\u5b8f\uff08linux\/unistd.h\uff09\u3002\u4f8b\u5982\uff0c\u5e26\u6709\u4e09\u4e2a\u53c2\u6570\u7684\u7cfb\u7edf\u8c03\u7528\u88ab\u5b9a\u4e49\u4e3a\u5982\u4e0b\u6240\u793a\u7684\u5b8f\u3002\n
              type name(type1 arg1,type2 arg2,type3 arg3) \/\r\n{ \/\r\nlong __res; \/\r\n__asm__ volatile (  \"int $0x80\" \/\r\n                  : \"=a\" (__res) \/\r\n                  : \"0\" (__NR_##name),\"b\" ((long)(arg1)),\"c\" ((long)(arg2)), \/\r\n                    \"d\" ((long)(arg3))); \/\r\n__syscall_return(type,__res); \/\r\n}\r\n<\/pre>\n

              \u65e0\u8bba\u4f55\u65f6\u8c03\u7528\u5e26\u6709\u4e09\u4e2a\u53c2\u6570\u7684\u7cfb\u7edf\u8c03\u7528\uff0c\u4ee5\u4e0a\u5c55\u793a\u7684\u5b8f\u5c31\u4f1a\u7528\u4e8e\u6267\u884c\u8c03\u7528\u3002\u7cfb\u7edf\u8c03\u7528\u53f7\u4f4d\u4e8e eax \u4e2d\uff0c\u6bcf\u4e2a\u53c2\u6570\u4f4d\u4e8e ebx\u3001ecx\u3001edx \u4e2d\u3002\u6700\u540e \"int 0x80\" \u662f\u4e00\u6761\u7528\u4e8e\u6267\u884c\u7cfb\u7edf\u8c03\u7528\u7684\u6307\u4ee4\u3002\u8fd4\u56de\u503c\u88ab\u5b58\u50a8\u4e8e eax \u4e2d\u3002<\/p>\n

              \u6bcf\u4e2a\u7cfb\u7edf\u8c03\u7528\u90fd\u4ee5\u7c7b\u4f3c\u7684\u65b9\u5f0f\u5b9e\u73b0\u3002Exit \u662f\u4e00\u4e2a\u5355\u4e00\u53c2\u6570\u7684\u7cfb\u7edf\u8c03\u7528\uff0c\u8ba9\u6211\u4eec\u770b\u770b\u5b83\u7684\u4ee3\u7801\u770b\u8d77\u6765\u4f1a\u662f\u600e\u6837\u3002\u5b83\u5982\u4e0b\u6240\u793a\u3002<\/p>\n

              {\r\n        asm(\"movl $1,%%eax;         \/* SYS_exit is 1 *\/\r\n             xorl %%ebx,%%ebx;      \/* Argument is in ebx, it is 0 *\/\r\n             int  $0x80\"            \/* Enter kernel mode *\/\r\n            );\r\n}\r\n<\/pre>\n

              Exit \u7684\u7cfb\u7edf\u8c03\u7528\u53f7\u662f 1\uff0c\u540c\u65f6\u5b83\u7684\u53c2\u6570\u662f 0\u3002\u56e0\u6b64\u6211\u4eec\u5206\u914d eax \u5305\u542b 1\uff0cebx \u5305\u542b 0\uff0c\u540c\u65f6\u901a\u8fc7 \"int $0x80\" \u6267\u884c \"exit(0)\"\u3002\u8fd9\u5c31\u662f exit \u7684\u5de5\u4f5c\u539f\u7406\u3002<\/li>\n<\/ol>\n

              8. \u7ed3\u675f\u8bed<\/strong><\/div>\n

              \u8fd9\u7bc7\u6587\u6863\u5df2\u7ecf\u5c06 GCC \u5185\u8054\u6c47\u7f16\u8fc7\u4e86\u4e00\u904d\u3002\u4e00\u65e6\u4f60\u7406\u89e3\u4e86\u57fa\u672c\u6982\u5ff5\uff0c\u4f60\u5c31\u53ef\u4ee5\u6309\u7167\u81ea\u5df1\u7684\u9700\u6c42\u53bb\u4f7f\u7528\u5b83\u4eec\u4e86\u3002\u6211\u4eec\u770b\u4e86\u8bb8\u591a\u4f8b\u5b50\uff0c\u5b83\u4eec\u6709\u52a9\u4e8e\u7406\u89e3 GCC \u5185\u8054\u6c47\u7f16\u7684\u5e38\u7528\u7279\u6027\u3002<\/p>\n

              GCC \u5185\u8054\u662f\u4e00\u4e2a\u6781\u5927\u7684\u4e3b\u9898\uff0c\u8fd9\u7bc7\u6587\u7ae0\u662f\u4e0d\u5b8c\u6574\u7684\u3002\u66f4\u591a\u5173\u4e8e\u6211\u4eec\u8ba8\u8bba\u8fc7\u7684\u8bed\u6cd5\u7ec6\u8282\u53ef\u4ee5\u5728 GNU \u6c47\u7f16\u5668\u7684\u5b98\u65b9\u6587\u6863\u4e0a\u83b7\u53d6\u3002\u7c7b\u4f3c\u5730\uff0c\u8981\u83b7\u53d6\u5b8c\u6574\u7684\u7ea6\u675f\u5217\u8868\uff0c\u53ef\u4ee5\u53c2\u8003 GCC \u7684\u5b98\u65b9\u6587\u6863\u3002<\/p>\n

              \u5f53\u7136\uff0cLinux \u5185\u6838\u5927\u91cf\u5730\u4f7f\u7528\u4e86 GCC \u5185\u8054\u3002\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u5728\u5185\u6838\u6e90\u7801\u4e2d\u53d1\u73b0\u8bb8\u591a\u5404\u79cd\u5404\u6837\u7684\u4f8b\u5b50\u3002\u5b83\u4eec\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5f88\u591a\u3002<\/p>\n

              \u5982\u679c\u4f60\u53d1\u73b0\u4efb\u4f55\u7684\u9519\u522b\u5b57\uff0c\u6216\u8005\u672c\u6587\u4e2d\u7684\u4fe1\u606f\u5df2\u7ecf\u8fc7\u65f6\uff0c\u8bf7\u544a\u8bc9\u6211\u4eec\u3002<\/p>\n

              \n

              \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-7688-1.html<\/a><\/p>\n

              \u672c\u6587\u5730\u5740\uff1ahttp:\/\/lrxjmw.cn\/gcc-how-to.html<\/a>\u7f16\u8f91\uff1a\u5f20\u632f\u5b87\uff0c\u5ba1\u6838\u5458\uff1a\u82cf\u897f\u4e91<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

              v0.1, 01 March 2003.\u672c HOWTO \u6587\u6863\u5c06\u8bb2\u89e3 GCC \u63d0\u4f9b\u7684\u5185\u8054\u6c47\u7f16\u7279\u6027\u7684\u7528\u9014\u548c\u7528\u6cd5\u3002\u5bf9\u4e8e\u9605\u8bfb\u8fd9\u7bc7\u6587\u7ae0\uff0c\u8fd9\u91cc\u53ea\u6709\u4e24\u4e2a\u524d\u63d0\u8981\u6c42\uff0c\u5f88\u660e\u663e\uff0c\u5c31\u662f x86 \u6c47\u7f16\u8bed\u8a00\u548c C \u8bed\u8a00\u7684\u57fa\u672c\u8ba4\u8bc6\u3002<\/p>\n","protected":false},"author":310,"featured_media":29415,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-26922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/26922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=26922"}],"version-history":[{"count":54,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/26922\/revisions"}],"predecessor-version":[{"id":259537,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/26922\/revisions\/259537"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/29415"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=26922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=26922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=26922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}