{"id":42735,"date":"2025-06-10T08:55:10","date_gmt":"2025-06-10T00:55:10","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/42735.html"},"modified":"2025-06-10T08:55:10","modified_gmt":"2025-06-10T00:55:10","slug":"%e5%93%88%e5%b7%a5%e5%a4%a7%e8%ae%a1%e7%ae%97%e6%9c%ba%e7%b3%bb%e7%bb%9f2024%e5%a4%a7%e4%bd%9c%e4%b8%9a-hello%e7%9a%84%e7%a8%8b%e5%ba%8f%e4%ba%ba%e7%94%9f","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/42735.html","title":{"rendered":"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f"},"content":{"rendered":"<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u8ba1\u7b97\u673a\u7cfb\u7edf<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u5927\u4f5c\u4e1a<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u9898 \u00a0\u00a0\u00a0\u00a0\u76ee\u00a0\u00a0\u7a0b\u5e8f\u4eba\u751f-Hello\u2019s P2P \u00a0<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u4e13 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e1a \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4eba\u5de5\u667a\u80fd \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u5b66\u3000\u3000 \u00a0\u00a0\u53f7 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02022112040 \u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u73ed \u00a0\u00a0\u7ea7\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02203601\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0\u00a0 <\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u5b66 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u751f \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u90c4\u4e1c\u6615 \u00a0\u00a0 \u00a0\u00a0\u00a0 <\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u6307 \u5bfc \u6559 \u5e08\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5434\u9510\u00a0\u00a0\u00a0\u00a0\u00a0 <\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u8ba1\u7b97\u673a\u79d1\u5b66\u4e0e\u6280\u672f\u5b66\u9662<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">2024\u5e745\u6708<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6458 \u00a0\u8981<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u672c\u7bc7\u8bba\u6587\u7684\u76ee\u7684\u662f\u89e3\u91caC\u8bed\u8a00\u7a0b\u5e8f\u5982\u4f55\u4ece\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4ee5hello.c\u7a0b\u5e8f\u4e3a\u4f8b&#xff0c;\u672c\u6587\u8be6\u7ec6\u5206\u6790\u4e86\u8ba1\u7b97\u673a\u5728\u751f\u6210hello\u53ef\u6267\u884c\u6587\u4ef6\u7684\u9884\u5904\u7406\u3001\u7f16\u8bd1\u3001\u6c47\u7f16\u3001\u94fe\u63a5\u3001\u8fdb\u7a0b\u7ba1\u7406\u7b49\u6574\u4e2a\u751f\u547d\u5468\u671f\u3002Hello\u4ece\u6700\u5f00\u59cb\u7684C\u8bed\u8a00\u6e90\u4ee3\u7801&#xff0c;\u4f1a\u5148\u7ecf\u8fc7\u4ed6\u201c\u673a\u751f\u201d\u7684\u7b2c\u4e00\u6b65\u2014\u2014\u9884\u5904\u7406&#xff1b;\u63a5\u7740\u4f1a\u7ee7\u7eed\u53d8\u5316&#xff0c;\u4ece\u4e00\u4e2a\u9752\u6da9\u7684.i\u6587\u4ef6\u53d8\u5316\u6210\u66f4\u80fd\u8ba9\u673a\u5668\u7406\u89e3\u7684.s\u6c47\u7f16\u6587\u4ef6&#xff1b;\u968f\u7740Hello\u7684\u4e00\u6b65\u4e00\u6b65\u6210\u957f&#xff0c;\u4ed6\u4f1a\u7ecf\u8fc7\u6c47\u7f16\u3001\u94fe\u63a5\u7b49\u4e00\u7cfb\u5217\u7684\u52a8\u4f5c\u5904\u7406&#xff0c;\u53d8\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u8fd9\u4e5f\u6807\u5fd7\u7740\u5b83\u5373\u5c06\u8fc8\u5165\u201c\u673a\u751f\u201d\u7684\u4e00\u4e2a\u65b0\u9636\u6bb5\u3002\u5728\u4e0b\u4e00\u4e2a\u9636\u6bb5\u4e2d&#xff0c;\u5b83\u4f1a\u548c\u64cd\u4f5c\u7cfb\u7edf\u8fdb\u884c\u4ea4\u8c08&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u50cf\u5b83\u7684\u4f2f\u4e50\u4e00\u6837&#xff0c;\u7ed9\u4ed6\u5f00\u8f9f\u8fdb\u7a0b&#xff0c;\u63d0\u4f9b\u865a\u62df\u5185\u5b58\u548c\u72ec\u7acb\u7684\u5730\u5740\u7a7a\u95f4&#xff1b;\u7ed9\u5b83\u5212\u5206\u65f6\u95f4\u7247\u3001\u903b\u8f91\u63a7\u5236\u6d41\u6765\u8ba9\u5b83\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7545\u6e38&#xff0c;\u6700\u540e\u968f\u7740\u8fdb\u7a0b\u7684\u7ed3\u675f&#xff0c;\u505c\u6b62\u8fd9\u77ed\u6682\u800c\u8f89\u714c\u7684\u673a\u751f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u672c\u6587\u4e0d\u4ec5\u7406\u8bba\u4e0a\u63a2\u8ba8\u4e86Hello\u4e00\u751f\u4e2d\u6240\u7ecf\u5386\u7684\u5177\u4f53\u9636\u6bb5&#xff0c;\u8fd8\u5b9e\u9645\u6f14\u793a\u4e86\u5b83\u4eec\u7684\u64cd\u4f5c\u548c\u7ed3\u679c&#xff0c;\u9610\u8ff0\u4e86\u8ba1\u7b97\u673a\u7cfb\u7edf\u7684\u5de5\u4f5c\u539f\u7406\u548c\u4f53\u7cfb\u7ed3\u6784&#xff0c;\u5e2e\u52a9\u8bfb\u8005\u66f4\u6df1\u5165\u5730\u7406\u89e3\u548c\u638c\u63e1C\u8bed\u8a00\u7a0b\u5e8f\u7684\u7f16\u8bd1\u548c\u6267\u884c\u8fc7\u7a0b\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5173\u952e\u8bcd&#xff1a;\u8ba1\u7b97\u673a\u7cfb\u7edf;\u8ba1\u7b97\u673a\u4f53\u7cfb\u7ed3\u6784;\u6c47\u7f16\u8bed\u8a00&#xff1b;\u94fe\u63a5\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u76ee \u00a0\u5f55<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c1\u7ae0 \u6982\u8ff0<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">1.1 Hello\u7b80\u4ecb<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">1.2 \u73af\u5883\u4e0e\u5de5\u5177<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">1.3 \u4e2d\u95f4\u7ed3\u679c<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">1.4 \u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c2\u7ae0 \u9884\u5904\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">2.1 \u9884\u5904\u7406\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">2.2\u5728Ubuntu\u4e0b\u9884\u5904\u7406\u7684\u547d\u4ee4<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">2.3 Hello\u7684\u9884\u5904\u7406\u7ed3\u679c\u89e3\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">2.4 \u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c3\u7ae0 \u7f16\u8bd1<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">3.1 \u7f16\u8bd1\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">3.2 \u5728Ubuntu\u4e0b\u7f16\u8bd1\u7684\u547d\u4ee4<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">3.3 Hello\u7684\u7f16\u8bd1\u7ed3\u679c\u89e3\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">3.4 \u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c4\u7ae0 \u6c47\u7f16<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">4.1 \u6c47\u7f16\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">4.2 \u5728Ubuntu\u4e0b\u6c47\u7f16\u7684\u547d\u4ee4<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">4.3 \u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807elf\u683c\u5f0f<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">4.4 Hello.o\u7684\u7ed3\u679c\u89e3\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">4.5 \u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c5\u7ae0 \u94fe\u63a5<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.1 \u94fe\u63a5\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.2 \u5728Ubuntu\u4e0b\u94fe\u63a5\u7684\u547d\u4ee4<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.3 \u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6hello\u7684\u683c\u5f0f<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.4 hello\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.5 \u94fe\u63a5\u7684\u91cd\u5b9a\u4f4d\u8fc7\u7a0b\u5206\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.6 hello\u7684\u6267\u884c\u6d41\u7a0b<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.7 Hello\u7684\u52a8\u6001\u94fe\u63a5\u5206\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">5.8 \u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c6\u7ae0 hello\u8fdb\u7a0b\u7ba1\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.1 \u8fdb\u7a0b\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.2 \u7b80\u8ff0\u58f3Shell-bash\u7684\u4f5c\u7528\u4e0e\u5904\u7406\u6d41\u7a0b<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.3 Hello\u7684fork\u8fdb\u7a0b\u521b\u5efa\u8fc7\u7a0b<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.4 Hello\u7684execve\u8fc7\u7a0b<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.5 Hello\u7684\u8fdb\u7a0b\u6267\u884c<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.6 hello\u7684\u5f02\u5e38\u4e0e\u4fe1\u53f7\u5904\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">6.7\u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c7\u7ae0 hello\u7684\u5b58\u50a8\u7ba1\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.1 hello\u7684\u5b58\u50a8\u5668\u5730\u5740\u7a7a\u95f4<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.2 Intel\u903b\u8f91\u5730\u5740\u5230\u7ebf\u6027\u5730\u5740\u7684\u53d8\u6362-\u6bb5\u5f0f\u7ba1\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.3 Hello\u7684\u7ebf\u6027\u5730\u5740\u5230\u7269\u7406\u5730\u5740\u7684\u53d8\u6362-\u9875\u5f0f\u7ba1\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.4 TLB\u4e0e\u56db\u7ea7\u9875\u8868\u652f\u6301\u4e0b\u7684VA\u5230PA\u7684\u53d8\u6362<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.5 \u4e09\u7ea7Cache\u652f\u6301\u4e0b\u7684\u7269\u7406\u5185\u5b58\u8bbf\u95ee<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.6 hello\u8fdb\u7a0bfork\u65f6\u7684\u5185\u5b58\u6620\u5c04<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.7 hello\u8fdb\u7a0bexecve\u65f6\u7684\u5185\u5b58\u6620\u5c04<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.8 \u7f3a\u9875\u6545\u969c\u4e0e\u7f3a\u9875\u4e2d\u65ad\u5904\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.9\u52a8\u6001\u5b58\u50a8\u5206\u914d\u7ba1\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">7.10\u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7b2c8\u7ae0 hello\u7684IO\u7ba1\u7406<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">8.1 Linux\u7684IO\u8bbe\u5907\u7ba1\u7406\u65b9\u6cd5<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">8.2 \u7b80\u8ff0Unix IO\u63a5\u53e3\u53ca\u5176\u51fd\u6570<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">8.3 printf\u7684\u5b9e\u73b0\u5206\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">8.4 getchar\u7684\u5b9e\u73b0\u5206\u6790<\/span> <\/p>\n<p style=\"margin-left:12pt;text-align:left\"><span style=\"color:#0000ff\">8.5\u672c\u7ae0\u5c0f\u7ed3<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u7ed3\u8bba<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u9644\u4ef6<\/span> <\/p>\n<p style=\"text-align:left\"><span style=\"color:#0000ff\">\u53c2\u8003\u6587\u732e<\/span> <\/p>\n<h2 style=\"text-align:center\">\u7b2c1\u7ae0 \u6982\u8ff0<\/h2>\n<h3 style=\"text-align:justify\">1.1 Hello\u7b80\u4ecb<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">HelloWorld\u60f3\u5fc5\u662f\u6bcf\u4e00\u4e2a\u7a0b\u5e8f\u5458\u7684\u542f\u8499\u7a0b\u5e8f&#xff0c;\u5728\u8bf8\u5982Pycharm,CodeBlocks\u8fd9\u6837\u7684IDE\u4e2d\u3002\u6211\u4eec\u521b\u5efa\u65b0\u9879\u76ee\u65f6&#xff0c;\u9879\u76ee\u6587\u4ef6\u4e2d\u9ed8\u8ba4\u7684\u7a0b\u5e8f\u4fbf\u662f\u8f93\u51fa\u201cHello,world!\u201d\u3002\u8fd9\u4e2a\u770b\u4f3c\u975e\u5e38\u7b80\u5355\u7684\u7a0b\u5e8f,\u5176\u5b9e\u662f\u65e9\u5148\u7b2c\u4e00\u4e2a\u5b9e\u73b0\u7684P2P\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">P2P&#xff1a;\u5e76\u4e0d\u662fPeer-to-peer\u7684\u7b80\u79f0\u54e6&#xff01;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd9\u91cc\u9762\u7684P2P\u6307\u7684\u662f<span style=\"background-color:#ffffff\">From Program to Process<\/span><span style=\"background-color:#ffffff\">\u3002\u6307\u4ecehello.<\/span><span style=\"background-color:#ffffff\">c<\/span><span style=\"background-color:#ffffff\">&#xff08;<\/span><span style=\"background-color:#ffffff\">Program<\/span><span style=\"background-color:#ffffff\">&#xff09;\u53d8\u4e3a\u8fd0\u884c\u65f6\u8fdb\u7a0b&#xff08;<\/span><span style=\"background-color:#ffffff\">Process<\/span><span style=\"background-color:#ffffff\">&#xff09;\u3002<\/span>\u8981\u8ba9hello.c\u8fd9\u4e2aC\u8bed\u8a00\u7a0b\u5e8f\u8fd0\u884c\u8d77\u6765&#xff0c;\u9700\u8981\u5148\u628a\u5b83\u53d8\u6210\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u8fd9\u4e2a\u53d8\u5316\u8fc7\u7a0b\u6709\u56db\u4e2a\u9636\u6bb5&#xff1a;\u9884\u5904\u7406&#xff0c;\u7f16\u8bd1&#xff0c;\u6c47\u7f16&#xff0c;\u94fe\u63a5&#xff0c;\u7f16\u5199\u5b8c\u6210\u7684hello.c\u6587\u4ef6&#xff0c;\u9996\u5148\u7ecf\u8fc7\u9884\u5904\u7406\u5668\u9884\u5904\u7406\u751f\u6210hello.i\u6587\u4ef6&#xff1b;\u518d\u7ecf\u8fc7\u7f16\u8bd1\u5668\u7f16\u8bd1&#xff0c;\u751f\u6210\u6c47\u7f16\u4ee3\u7801\u6587\u4ef6hello.s&#xff1b;\u518d\u7ecf\u8fc7\u6c47\u7f16\u5668\u7ffb\u8bd1\u6210\u4e00\u4e2a\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6hello.o&#xff1b;\u6700\u540e\u4f7f\u7528\u94fe\u63a5\u5668\u5c06\u591a\u4e2a\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6\u7ec4\u5408\u8d77\u6765&#xff0c;\u5f62\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6hello\u3002(\u53ef\u6307\u5b9a\u4e3a.out\u6587\u4ef6)<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5b8c\u6210\u540e\u5c31\u5f97\u5230\u4e86\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u7136\u540e\u5c31\u53ef\u4ee5\u5728shell\u4e2d\u6267\u884c\u5b83&#xff0c;shell\u4f1a\u7ed9\u5b83\u5206\u914d\u8fdb\u7a0b\u7a7a\u95f4\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">020&#xff1a;\u5373<span style=\"background-color:#ffffff\">From Zero to Zero<\/span><span style=\"background-color:#ffffff\">\u3002\u6307\u6700\u521d\u5185\u5b58\u5e76\u65e0hello\u6587\u4ef6\u7684\u76f8\u5173\u5185\u5bb9&#xff0c;<\/span>shell\u7528execve\u51fd\u6570\u542f\u52a8hello\u7a0b\u5e8f&#xff0c;\u628a\u865a\u62df\u5185\u5b58\u5bf9\u5e94\u5230\u7269\u7406\u5185\u5b58&#xff0c;\u5e76\u4ece\u7a0b\u5e8f\u5165\u53e3\u5f00\u59cb\u52a0\u8f7d\u548c\u8fd0\u884c&#xff0c;\u8fdb\u5165main\u51fd\u6570\u6267\u884c\u76ee\u6807\u4ee3\u7801&#xff0c;\u7a0b\u5e8f\u7ed3\u675f\u540e&#xff0c;shell\u7236\u8fdb\u7a0b\u56de\u6536hello\u8fdb\u7a0b&#xff0c;\u5185\u6838\u5220\u9664<span style=\"background-color:#ffffff\">hello\u6587\u4ef6<\/span>\u76f8\u5173\u7684\u6570\u636e\u7ed3\u6784\u3002\u5728execve\u51fd\u6570\u6267\u884chello\u7a0b\u5e8f\u540e&#xff0c;\u5185\u6838\u4e3a\u5176\u6620\u5c04\u865a\u62df\u5185\u5b58\u3001\u5206\u914d\u7269\u7406\u5185\u5b58&#xff1b;\u7a0b\u5e8f\u5f00\u59cb\u6267\u884c&#xff0c;\u5185\u6838\u4e3a\u7a0b\u5e8f\u5206\u914d\u65f6\u95f4\u7247\u6267\u884c\u903b\u8f91\u63a7\u5236\u6d41\u3002\u5f53hello\u8fd0\u884c\u7ed3\u675f&#xff0c;\u7531shell\u56de\u6536hello\u8fdb\u7a0b&#xff0c;\u5220\u9664\u6709\u5173\u7684\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<h3 style=\"text-align:justify\">1.2 \u73af\u5883\u4e0e\u5de5\u5177<\/h3>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u786c\u4ef6\u73af\u5883&#xff1a;<\/span><\/p>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u5904\u7406\u5668&#xff1a;12th Gen Intel(R) Core(TM)i7-12700H \u00a0\u00a02.70 GHz<\/span><\/p>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u673a\u5e26RAM&#xff1a;16.0GB<\/span><\/p>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u7cfb\u7edf\u7c7b\u578b&#xff1a;64\u4f4d\u64cd\u4f5c\u7cfb\u7edf&#xff0c;\u57fa\u4e8ex64\u7684\u5904\u7406\u5668<\/span><\/p>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u8f6f\u4ef6\u73af\u5883&#xff1a;Windows11 64\u4f4d\u00a0\u7248\u672c\u53f724H2&#xff0c;<span style=\"background-color:#ffffff\">VMware<\/span><span style=\"background-color:#ffffff\">&#xff0c;<\/span>Ubuntu 18.04 LTS<\/span><\/p>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u5f00\u53d1\u4e0e\u8c03\u8bd5\u5de5\u5177&#xff1a;Visual Studio 1.89.0&#xff1b;vim,gidit ,objdump,edb,gcc,readelf\u7b49\u5f00\u53d1\u5de5\u5177<\/span><\/p>\n<h3 style=\"text-align:justify\">1.3 \u4e2d\u95f4\u7ed3\u679c<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5217\u51fa\u4f60\u4e3a\u7f16\u5199\u672c\u8bba\u6587&#xff0c;\u751f\u6210\u7684\u4e2d\u95f4\u7ed3\u679c\u6587\u4ef6\u7684\u540d\u5b57&#xff0c;\u6587\u4ef6\u7684\u4f5c\u7528\u7b49\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello.c:\u539f\u59cbhello\u7a0b\u5e8f\u7684C\u8bed\u8a00\u4ee3\u7801<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello.i:\u9884\u5904\u7406\u8fc7\u540e\u7684hello\u4ee3\u7801<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello.s:\u7531\u9884\u5904\u7406\u4ee3\u7801\u751f\u6210\u7684\u6c47\u7f16\u4ee3\u7801<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello.o:\u4e8c\u8fdb\u5236\u76ee\u6807\u4ee3\u7801<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello:\u8fdb\u884c\u94fe\u63a5\u540e\u7684\u53ef\u6267\u884c\u7a0b\u5e8f<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello_asm.txt:\u53cd\u6c47\u7f16hello.o\u5f97\u5230\u7684\u53cd\u6c47\u7f16\u6587\u4ef6<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello1_asm.txt:\u53cd\u6c47\u7f16hello\u53ef\u6267\u884c\u6587\u4ef6\u5f97\u5230\u7684\u53cd\u6c47\u7f16\u6587\u4ef6<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<h3 style=\"text-align:justify\">1.4 \u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u7ae0\u9996\u5148\u4ecb\u7ecd\u4e86hello\u7684P2P&#xff0c;020\u6d41\u7a0b&#xff0c;\u5305\u62ec\u6d41\u7a0b\u7684\u8bbe\u8ba1\u601d\u8def\u548c\u5b9e\u73b0\u65b9\u6cd5&#xff1b;\u7136\u540e&#xff0c;\u8be6\u7ec6\u8bf4\u660e\u4e86\u672c\u5b9e\u9a8c\u6240\u9700\u7684\u786c\u4ef6\u914d\u7f6e\u3001\u8f6f\u4ef6\u5e73\u53f0\u3001\u5f00\u53d1\u5de5\u5177\u4ee5\u53ca\u672c\u5b9e\u9a8c\u751f\u6210\u7684\u5404\u4e2a\u4e2d\u95f4\u7ed3\u679c\u6587\u4ef6\u7684\u540d\u79f0\u548c\u529f\u80fd\u3002<\/p>\n<h2 style=\"text-align:center\">\u7b2c2\u7ae0 \u9884\u5904\u7406<\/h2>\n<h3 style=\"text-align:justify\">2.1\u00a0\u9884\u5904\u7406\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">2.1.1\u9884\u5904\u7406\u6982\u5ff5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9884\u5904\u7406\u7684\u6982\u5ff5&#xff1a;\u987e\u540d\u601d\u4e49&#xff0c;\u9884\u5904\u7406\u662f\u6307\u5728\u6e90\u7a0b\u5e8f\u88ab\u7f16\u8bd1\u5668\u5904\u7406\u4e4b\u524d,cpp\u6839\u636e\u6e90\u6587\u4ef6\u4e2d\u7684\u5b8f\u5b9a\u4e49\u3001\u6761\u4ef6\u7f16\u8bd1\u7b49\u547d\u4ee4\u5bf9\u6e90\u6587\u4ef6\u4f5c\u4ee5\u4fee\u6539&#xff0c;\u6267\u884c\u4e00\u4e9b\u9884\u5904\u7406\u547d\u4ee4&#xff0c;\u5982\u5b8f\u66ff\u6362&#xff0c;\u5934\u6587\u4ef6\u5305\u542b&#xff0c;\u6761\u4ef6\u7f16\u8bd1&#xff0c;\u6ce8\u91ca\u5220\u9664\u7b49\u3002\u8bf7\u6ce8\u610f&#xff0c;\u6b64\u8fc7\u7a0b\u53d1\u751f\u5728\u751f\u6210\u4e8c\u8fdb\u5236\u4ee3\u7801\u4e4b\u524d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2.1.2\u9884\u5904\u7406\u4f5c\u7528<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f5c\u7528&#xff1a;\u603b\u7684\u6765\u8bf4&#xff0c;\u9884\u5904\u7406\u9636\u6bb5\u7684\u4f5c\u7528\u662f\u4e3a\u7f16\u8bd1\u5668\u63d0\u4f9b\u4e00\u4e2a\u7ecf\u8fc7\u5904\u7406\u7684\u6e90\u4ee3\u7801\u6587\u4ef6&#xff0c;\u4ee5\u4fbf\u8fdb\u884c\u540e\u7eed\u7684\u7f16\u8bd1\u5de5\u4f5c\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5e76\u4e0d\u5bf9\u7a0b\u5e8f\u7684\u6e90\u4ee3\u7801\u8fdb\u884c\u89e3\u6790&#xff0c;\u4f46\u5b83\u628a\u6e90\u4ee3\u7801\u5206\u5272\u6216\u5904\u7406\u6210\u4e3a\u7279\u5b9a\u7684\u5355\u4f4d\u3002<\/p>\n<h3 style=\"text-align:justify\">2.2\u5728Ubuntu\u4e0b\u9884\u5904\u7406\u7684\u547d\u4ee4<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u8f93\u5165gcc -m64 -no-pie -fno-PIC -E hello.c -o hello.i &#xff0c;\u56de\u8f66&#xff0c;\u8fd9\u6837\u4fbf\u5728\u539f\u76ee\u5f55\u751f\u6210\u4e86hello.i\u6587\u4ef6\u3002<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"72\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b21cbc.png\" width=\"1200\" \/><\/p>\n<h3 style=\"text-align:justify\">2.3 Hello\u7684\u9884\u5904\u7406\u7ed3\u679c\u89e3\u6790<\/h3>\n<p style=\"text-align:justify\"><span style=\"background-color:#ffffff\">\u5728Linux\u4e0b\u6211\u4eec\u4f7f\u7528gedit\u6253\u5f00hello.i\u6587\u4ef6&#xff0c;<span style=\"color:#111111\">\u6211\u4eec\u5bf9\u6bd4\u4e86\u6e90\u7a0b\u5e8f\u548c\u9884\u5904\u7406\u540e\u7684\u7a0b\u5e8f\u3002\u7ed3\u679c\u663e\u793a&#xff0c;<\/span>\u89c2\u5bdf\u53d1\u73b0&#xff0c;\u5176\u4e2d\u7684\u6ce8\u91ca\u5df2\u7ecf\u6d88\u5931&#xff0c;\u524d\u4e00\u90e8\u5206\u7684\u4ee3\u7801\u4e3a\u88ab\u52a0\u8f7d\u5230\u7a0b\u5e8f\u4e2d\u7684\u5934\u6587\u4ef6&#xff1b;\u7a0b\u5e8f\u7684\u6700\u540e\u4e00\u90e8\u5206\u4e0ehello.c\u4e2d\u7684main\u51fd\u6570\u5b8c\u5168\u76f8\u540c\u3002<span style=\"color:#111111\">\u9664\u4e86\u9884\u5904\u7406\u6307\u4ee4\u88ab\u6269\u5c55\u6210\u4e86<\/span><span style=\"color:#111111\">\u4e09\u5343\u591a\u884c<\/span><span style=\"color:#111111\">\u4e4b\u5916&#xff0c;\u6e90\u7a0b\u5e8f\u7684\u5176\u4ed6\u90e8\u5206\u90fd\u4fdd\u6301\u4e0d\u53d8&#xff0c;\u8bf4\u660e.c\u6587\u4ef6\u7684\u786e\u662f\u88ab\u4fee\u6539\u8fc7\u4e86\u3002<\/span><\/span><\/p>\n<p style=\"text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"718\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b35d5d.png\" width=\"901\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u56fe2.3-1 hello.i\u6587\u4ef6\u5185\u5bb9\u4e00\u89c8<\/p>\n<p style=\"text-align:left\"><span style=\"background-color:#ffffff\">\u5728main\u51fd\u6570\u4ee3\u7801\u51fa\u73b0\u4e4b\u524d\u7684\u5927\u6bb5\u4ee3\u7801\u6e90\u81ea\u4e8e\u7684\u5934\u6587\u4ef6&lt;stdio.h&gt;\u00a0 &lt;unistd.h&gt; \u00a0&lt;stdlib.h&gt;\u00a0\u7684\u4f9d\u6b21\u5c55\u5f00\u3002<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4ee5 stdio.h \u7684\u5c55\u5f00\u4e3a\u4f8b&#xff1a;#include\u6307\u4ee4\u7684\u4f5c\u7528\u662f\u628a\u6307\u5b9a\u7684\u5934\u6587\u4ef6\u7684\u5185\u5bb9\u5305\u542b\u5230\u6e90\u6587\u4ef6\u4e2d\u3002stdio.h\u662f\u201cstandard input &amp; output\u201d&#xff08;\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93&#xff09;\u7684\u5934\u6587\u4ef6&#xff0c;\u5b83\u5305\u542b\u4e86\u7528\u4e8e\u8bfb\u5199\u6587\u4ef6&#xff08;scanf()&#xff09;\u3001\u6807\u51c6\u8f93\u5165\u8f93\u51fa(printf())\u7684\u51fd\u6570\u539f\u578b\u548c\u5b8f\u5b9a\u4e49\u7b49\u5185\u5bb9\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f53\u9884\u5904\u7406\u5668\u9047\u5230#include&lt;stdio.h&gt;\u65f6&#xff0c;\u5b83\u4f1a\u5728\u7cfb\u7edf\u7684\u5934\u6587\u4ef6\u8def\u5f84\u4e0b\u67e5\u627estdio.h\u6587\u4ef6&#xff0c;\u4e00\u822c\u5728\/usr\/include\u76ee\u5f55\u4e0b&#xff0c;\u7136\u540e\u628astdio.h\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u590d\u5236\u5230\u6e90\u6587\u4ef6\u4e2d\u3002stdio.h\u6587\u4ef6\u4e2d\u53ef\u80fd\u8fd8\u6709\u5176\u4ed6\u7684#include\u6307\u4ee4&#xff0c;\u6bd4\u5982#include&lt;stddef.h&gt;\u6216#include&lt;math.h&gt;\u7b49&#xff0c;\u8fd9\u4e9b\u5934\u6587\u4ef6\u4e5f\u4f1a\u88ab\u9012\u5f52\u5730\u5c55\u5f00\u5230\u6e90\u6587\u4ef6\u4e2d\u3002<\/p>\n<p style=\"text-align:left\"><span style=\"background-color:#ffffff\">\u9884\u5904\u7406\u5668\u4e0d\u4f1a\u5bf9\u5934\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u505a\u4efb\u4f55\u8ba1\u7b97\u6216\u8f6c\u6362&#xff0c;\u53ea\u662f\u7b80\u5355\u5730\u590d\u5236\u548c\u66ff\u6362\u3002<\/span><\/p>\n<h3 style=\"text-align:justify\">2.4 \u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u7ae0\u8bb2\u8ff0\u4e86\u5728linux\u73af\u5883\u4e2d&#xff0c;\u5982\u4f55\u7528\u547d\u4ee4\u5bf9C\u8bed\u8a00\u7a0b\u5e8f\u8fdb\u884c\u9884\u5904\u7406&#xff0c;\u4ee5\u53ca\u9884\u5904\u7406\u7684\u542b\u4e49\u548c\u4f5c\u7528&#xff0c;\u63a5\u7740\u4ee5hello.c\u4e3a\u4f8b&#xff0c;\u6f14\u793a\u4e86\u5728Ubuntu\u4e0b\u5982\u4f55\u9884\u5904\u7406\u7a0b\u5e8f&#xff0c;\u5e76\u5bf9\u7ed3\u679c\u8fdb\u884c\u5206\u6790\u3002\u901a\u8fc7\u5206\u6790&#xff0c;\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\u9884\u5904\u7406\u540e\u7684\u6587\u4ef6hello.i\u5305\u542b\u4e86\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5e93stdio.h\u7684\u5185\u5bb9&#xff0c;\u4ee5\u53ca\u4e00\u4e9b\u5b8f\u548c\u5e38\u91cf\u7684\u5b9a\u4e49&#xff0c;\u8fd8\u6709\u4e00\u4e9b\u884c\u53f7\u4fe1\u606f\u548c\u6761\u4ef6\u7f16\u8bd1\u6307\u4ee4\u3002<\/p>\n<h2 style=\"text-align:center\">\u7b2c3\u7ae0 \u7f16\u8bd1<\/h2>\n<h3 style=\"text-align:justify\">3.1 \u7f16\u8bd1\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.1.1 \u7f16\u8bd1\u7684\u6982\u5ff5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f16\u8bd1\u662f\u6307\u5c06\u4eba\u7c7b\u53ef\u8bfb\u7684\u6e90\u4ee3\u7801\u7ffb\u8bd1\u6210\u6c47\u7f16\u4ee3\u7801\u7684\u8fc7\u7a0b\u3002\u7f16\u8bd1\u5668\u901a\u8fc7\u524d\u7aef\u8fdb\u884c\u8bcd\u6cd5\u5206\u6790\u3001\u8bed\u6cd5\u5206\u6790\u7b49&#xff0c;\u7136\u540e\u7ecf\u8fc7\u4f18\u5316\u5668\u8fdb\u884c\u4ee3\u7801\u4f18\u5316&#xff0c;\u6700\u7ec8\u7531\u540e\u7aef\u5c06\u4ee3\u7801\u7ffb\u8bd1\u6c47\u7f16\u4ee3\u7801\u3002\u7f16\u8bd1\u7684\u8fc7\u7a0b\u5305\u62ec\u7ffb\u8bd1\u3001\u4f18\u5316\u3001\u68c0\u67e5\u548c\u751f\u6210\u53ef\u6267\u884c\u6587\u4ef6\u7b49\u6b65\u9aa4&#xff0c;\u4ee5\u786e\u4fdd\u7a0b\u5e8f\u7684\u6b63\u786e\u6027\u548c\u6027\u80fd\u3002<\/p>\n<p style=\"margin-left:24pt;text-align:justify\">\u6ce8\u610f&#xff1a;\u8fd9\u513f\u7684\u7f16\u8bd1\u662f\u6307\u4ece .i \u5230 .s \u5373\u9884\u5904\u7406\u540e\u7684\u6587\u4ef6\u5230\u751f\u6210\u6c47\u7f16\u8bed\u8a00\u7a0b\u5e8f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.1.2 \u7f16\u8bd1\u7684\u4f5c\u7528<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f16\u8bd1\u7684\u4f5c\u7528\u662f\u4ea7\u751f\u6c47\u7f16\u8bed\u8a00\u6587\u4ef6&#xff0c;\u5e76\u4ea4\u7ed9\u673a\u5668\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916&#xff0c;\u7f16\u8bd1\u5668\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u529f\u80fd&#xff0c;\u4f8b\u5982\u8bed\u6cd5\u68c0\u67e5\u7b49\u3002<\/p>\n<h3 style=\"text-align:justify\">3.2 \u5728Ubuntu\u4e0b\u7f16\u8bd1\u7684\u547d\u4ee4<\/h3>\n<p style=\"margin-left:0pt;text-align:justify\">\u6253\u5f00\u7ec8\u7aef&#xff0c;\u8f93\u5165 gcc -m64 -no-pie -fno-PIC -S hello.c -o hello.\u5e76\u56de\u8f66&#xff0c;\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"margin-left:0pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"492\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b67f34.png\" width=\"742\" \/><\/p>\n<p style=\"margin-left:24pt;text-align:center\">\u56fe3.2-1 \u751f\u6210hello.s\u7684\u7ec8\u7aef\u622a\u56fe<\/p>\n<h3 style=\"text-align:justify\">3.3 Hello\u7684\u7f16\u8bd1\u7ed3\u679c\u89e3\u6790<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.0\u5148\u5907\u77e5\u8bc6\u2014\u2014\u6570\u636e\u7ed3\u6784\u4e0e\u7b97\u672f\u64cd\u4f5c<\/p>\n<p style=\"text-align:left\">\u5728\u89e3\u6790\u4e0b\u9762\u7684\u6c47\u7f16\u4ee3\u7801\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u5148\u4e86\u89e3\u6570\u636e\u5b58\u50a8\u7684\u683c\u5f0f\u4ee5\u53ca\u5bc4\u5b58\u5668\u7684\u5b58\u50a8\u7ed3\u6784&#xff0c;Intel\u6570\u636e\u7c7b\u578b\u4ee416bytes\u4e3a\u5b57&#xff0c;32bytes\u4e3a\u53cc\u5b57&#xff0c;\u5404\u79cd\u6570\u636e\u7c7b\u578b\u7684\u5927\u5c0f\u4e00\u7ea7\u5bc4\u5b58\u5668\u7684\u7ed3\u6784\u5982\u4e0b\u6240\u793a&#xff1a;<\/p>\n<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u53d8\u91cf\u7c7b\u578b<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">Intel\u6570\u636e\u7c7b\u578b<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6c47\u7f16\u4ee3\u7801\u540e\u7f00<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u5927\u5c0f&#xff08;\u5b57\u8282&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">char<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u5b57\u8282<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">b<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">short<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u5b57<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">w<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">int<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u53cc\u5b57<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">l<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">long<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u56db\u5b57<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">q<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">char *<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u56db\u5b57<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">q<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">float<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u5355\u7cbe\u5ea6<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">s<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">double<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u53cc\u7cbe\u5ea6<\/p>\n<\/td>\n<td style=\"width:109pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">l<\/p>\n<\/td>\n<td style=\"width:109.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">8<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;text-align:center\">\u88683.3.0-1 \u6570\u636e\u7c7b\u578b\u8868<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"70\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b7b6d9.png\" width=\"703\" \/>\u56fe3.3.0-2 \u5bc4\u5b58\u5668\u5b57\u957f\u793a\u610f\u56fe<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6b64\u5916&#xff0c;\u5bf9\u4e8e\u7b97\u672f\u8fd0\u7b97&#xff0c;\u6c47\u7f16\u8bed\u8a00\u7684\u89c4\u5b9a\u5982\u4e0b&#xff1a;<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"width:145.35pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">INC D<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">DEC D<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">NEG D<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">NOT D<\/p>\n<\/td>\n<td style=\"width:145.35pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190D &#043; 1<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190D &#8211; 1<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190 -D<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190 ~D<\/p>\n<\/td>\n<td style=\"width:145.35pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u52a01<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u51cf1<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u53d6\u8d1f<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u53d6\u8865<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:145.35pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">ADD S, D<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">SUB S, D<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">IMUL S, D<\/p>\n<\/td>\n<td style=\"width:145.35pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190D &#043; S<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190D &#8211; S<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">D\u2190D * S<\/p>\n<\/td>\n<td style=\"width:145.35pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u52a0<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u51cf<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u4e58<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;text-align:center\">\u88683.3.0-2 \u6c47\u7f16\u8bed\u8a00\u57fa\u672c\u7b97\u672f\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4f8b\u5982\u4e0b\u56fe&#xff0c;\u4e0b\u56fe\u7684\u64cd\u4f5c\u4fbf\u662f\u5c06rsp\u4e2d\u7684\u503c\u51cf\u53bb\u7acb\u5373\u657032\u3002\u81f3\u4e8e\u7acb\u5373\u6570\u5219\u4f1a\u5728\u540e\u6587\u8be6\u7ec6\u4ecb\u7ecd\u3002<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"42\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b86422.png\" width=\"402\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u8df3\u8f6c\u6307\u4ee4\u4f1a\u6839\u636e\u6761\u4ef6\u7801\u5f53\u524d\u7684\u503c\u6765\u8fdb\u884c\u76f8\u5e94\u7684\u8df3\u8f6c\u3002\u6bd4\u8f83\u5e38\u89c1\u7684\u662f\u76f4\u63a5\u8df3\u8f6c&#xff0c;\u5728hello.s\u4e2d\u4e5f\u6709\u4f53\u73b0&#xff0c;\u5982\u4e0b\u56fe\u6240\u793a\u3002cmpl\u6307\u4ee4\u5224\u65ad\u5bc4\u5b58\u5668\u4e2d\u7684\u503c\u548c\u7acb\u5373\u65704\u7684\u5927\u5c0f\u5173\u7cfb&#xff0c;\u8bbe\u7f6e\u6761\u4ef6\u7801&#xff0c;\u518d\u8fdb\u884cje\u3002je\u7684\u542b\u4e49\u662fjump if equal&#xff0c;\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u5982\u679c\u6b64\u65f6\u7684\u6761\u4ef6\u7801\u6240\u8868\u793a\u542b\u4e49\u4e3a\u76f8\u7b49&#xff0c;\u5219\u4f1a\u8df3\u8f6c\u5230\u76f8\u5e94\u7684.L2\u6307\u4ee4\u884c\u3002\u56e0\u6b64&#xff0c;\u8df3\u8f6c\u6307\u4ee4\u7528\u6765\u5b9e\u73b0\u6761\u4ef6\u5206\u652f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:left\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"253\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b90417.png\" width=\"817\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">call\u6307\u4ee4\u7528\u6765\u8fdb\u884c\u51fd\u6570\u7684\u8c03\u7528\u3002\u5982\u4e0b\u56fe\u6240\u793a\u7684\u793a\u4f8b&#xff0c;call\u8c03\u7528\u4e86puts\u51fd\u6570\u548cexit\u51fd\u6570\u3002call\u6307\u4ee4\u4f1a\u5148\u5c06\u51fd\u6570\u7684\u8fd4\u56de\u5730\u5740\u538b\u5165\u8fd0\u884c\u65f6\u6808\u4e2d&#xff0c;\u4e4b\u540e\u8df3\u8f6c\u5230\u76f8\u5e94\u7684\u51fd\u6570\u4ee3\u7801\u6bb5\u8fdb\u884c\u6267\u884c\u3002\u6267\u884c\u7ed3\u675f\u901a\u8fc7ret\u6307\u4ee4\u8fd4\u56de\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"196\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826baa8f7.png\" width=\"352\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u56fe3.3.0-4 call\u6307\u4ee4\u8c03\u7528\u5b9e\u4f8b<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f16\u8bd1\u8fc7\u7a0b\u662f\u6574\u4e2a\u8fc7\u7a0b\u6784\u5efa\u7684\u6838\u5fc3\u90e8\u5206&#xff0c;\u7f16\u8bd1\u6210\u529f\u4e4b\u540e&#xff0c;\u6e90\u4ee3\u7801\u4f1a\u4ece\u6587\u672c\u5f62\u5f0f\u8f6c\u6362\u4e3a\u673a\u5668\u8bed\u8a00\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6211\u4eec\u4f7f\u7528vim\u6253\u5f00hello.s,\u4f7f\u7528vim\u800c\u4e0d\u4f7f\u7528\u7cfb\u7edf\u81ea\u5e26gedit\u7684\u539f\u56e0\u662f&#xff0c;vim\u80fd\u591f\u81ea\u52a8\u9ad8\u4eae\u4e0d\u540c\u79cd\u7c7b\u7684\u6c47\u7f16\u4ee3\u7801\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u5bf9hello.s\u4e2d\u51fa\u73b0\u7684\u6c47\u7f16\u6307\u4ee4\u8fdb\u884c\u8be6\u7ec6\u7684\u4ecb\u7ecd\u3002<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"543\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826bb9334.png\" width=\"1126\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u56fe3.3.0-6 \u4f7f\u7528vim\u6253\u5f00hello.s<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.1 \u6587\u4ef6\u4fe1\u606f\u8bb0\u5f55<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"301\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826c223b9.png\" width=\"1035\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u56fe3.3.1-1 hello.s\u5f00\u5934\u4fe1\u606f<\/p>\n<p style=\"text-align:left\">\u9996\u5148\u662f\u8bb0\u5f55\u6587\u4ef6\u76f8\u5173\u4fe1\u606f\u7684\u6c47\u7f16\u4ee3\u7801\u3002\u7b2c\u4e00\u90e8\u5206\u7684\u6c47\u7f16\u4ee3\u7801\u6709\u4e00\u90e8\u5206\u662f\u4ee5.\u4f5c\u4e3a\u5f00\u5934\u7684\u4ee3\u7801\u6bb5\u3002\u8fd9\u4e9b\u4ee3\u7801\u6bb5\u662f\u6307\u5bfc\u6c47\u7f16\u5668\u548c\u8fde\u63a5\u5668\u5de5\u4f5c\u7684\u4f2a\u6307\u4ee4\u3002\u8fd9\u6bb5\u4ee3\u7801\u5bf9\u6211\u4eec\u6765\u8bf4\u6ca1\u6709\u4ec0\u4e48\u610f\u4e49&#xff0c;\u901a\u5e38\u53ef\u4ee5\u5ffd\u7565\u8fd9\u4e9b\u4ee3\u7801&#xff0c;\u4f46\u5bf9\u6c47\u7f16\u5668\u548c\u8fde\u63a5\u5668\u7f3a\u662f\u5341\u5206\u91cd\u8981\u7684&#xff0c;\u4e3a\u4e4b\u540e\u94fe\u63a5\u8fc7\u7a0b\u4f7f\u7528\u3002\u4f2a\u4ee3\u7801\u7684\u5177\u4f53\u542b\u4e49\u89c1\u4e0b\u8868\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u4f2a\u4ee3\u7801<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u542b\u4e49<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.file<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u58f0\u660e\u6e90\u6587\u4ef6&#xff08;\u6b64\u5904\u4e3ahello.c&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.text<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u58f0\u660e\u4ee3\u7801\u8282<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.section<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6587\u4ef6\u4ee3\u7801\u6bb5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.rodata<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u53ea\u8bfb\u6587\u4ef6(Read-only)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.align<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6570\u636e\u6307\u4ee4\u5730\u5740\u5bf9\u9f50\u65b9\u5f0f&#xff08;\u6b64\u5904\u4e3a8\u5bf9\u9f50&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.string<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u58f0\u660e\u5b57\u7b26\u4e32&#xff08;\u6b64\u5904\u58f0\u660e\u4e86LC0\u548cLC1&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.globl<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u58f0\u660e\u5168\u5c40\u53d8\u91cf<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:156.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">.type<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:267.7pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u58f0\u660e\u53d8\u91cf\u7c7b\u578b&#xff08;\u6b64\u5904\u58f0\u660e\u4e3a\u51fd\u6570\u7c7b\u578b&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;text-align:center\">\u88683.3.1-2 hello.s\u4f2a\u4ee3\u7801\u5177\u4f53\u542b\u4e49<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.2 \u5bf9\u5c40\u90e8\u53d8\u91cf\u7684\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello\u4e2d\u6d89\u53ca\u5c40\u90e8\u53d8\u91cf\u64cd\u4f5c\u7684\u5730\u65b9\u4e3b\u8981\u662f\u6e90\u7a0b\u5e8f\u4e2d\u7684\u7b2c10\u884cint i\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"520\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826c4b399.png\" width=\"726\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u56fe3.3.2-1 hello.c\u622a\u56fe<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u5bf9\u5e94\u7684\u6c47\u7f16\u8bed\u8a00\u4e2d&#xff0c;\u5c40\u90e8\u53d8\u91cf\u4f1a\u88ab\u5b58\u50a8\u5728\u6808\u4e0a\u3002\u5f53\u8fdb\u5165\u4e3b\u51fd\u6570main\u65f6&#xff0c;\u4f1a\u5728\u6808\u4e0a\u7533\u8bf7\u4e00\u6bb5\u7a7a\u95f4\u6765\u4f9b\u5c40\u90e8\u53d8\u91cf\u4f7f\u7528\u3002\u5f53\u5c40\u90e8\u53d8\u91cf\u4f7f\u7528\u5b8c\u6bd5\u4e4b\u540e&#xff0c;\u8fd9\u6bb5\u7533\u8bf7\u7a7a\u95f4\u4f1a\u88ab\u91ca\u653e\u3002\u5982\u4e0b\u56fe\u6240\u793a&#xff0c;\u5728\u7ea2\u6846\u4e2d&#xff0c;\u6808\u6307\u9488\u5411\u4e0b\u79fb\u52a8\u4e8632\u4e2a\u5b57\u8282&#xff0c;\u5728\u6808\u4e2d\u4e3a\u5c40\u90e8\u53d8\u91cfi\u4fdd\u7559\u4e86\u7a7a\u95f4\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"349\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826c62dc4.png\" width=\"323\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.3 \u5bf9\u5b57\u7b26\u4e32\u5e38\u91cf\u7684\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728main\u51fd\u6570\u4e4b\u524d\u524d&#xff0c;\u5728.rodata\u5904\u7684.LC0\u548c.LC1\u5df2\u7ecf\u5b58\u50a8\u4e86\u5b57\u7b26\u4e32\u5e38\u91cf&#xff0c;\u6807\u8bb0\u8be5\u4f4d\u7f6e\u662f\u4ee3\u7801\u662f\u53ea\u8bfb\u7684\u3002<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"225\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826c7b47a.png\" width=\"1099\" \/>\u5728main\u51fd\u6570\u4e2d\u4f7f\u7528\u5b57\u7b26\u4e32\u65f6&#xff0c;\u5f97\u5230\u5b57\u7b26\u4e32\u7684\u9996\u5730\u5740&#xff08;leaq\u76f8\u5f53\u4e8e\u8f6c\u79fb\u64cd\u4f5c&#xff09;&#xff0c;\u5982\u4e0b\u56fe\u7ea2\u6846\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"311\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826c99be7.png\" width=\"212\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.4 \u5bf9\u7acb\u5373\u6570\u7684\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u6c47\u7f16\u8bed\u8a00\u4e2d&#xff0c;\u7acb\u5373\u6570\u7528\u201c$\u201d\u540e\u52a0\u6570\u5b57\u8868\u793a&#xff0c;\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"300\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826cac8d0.png\" width=\"394\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.5 \u8d4b\u503c\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8d4b\u503c\u64cd\u4f5c\u5f88\u7b80\u5355&#xff0c;\u7528movq\u6307\u4ee4\u5373\u53ef&#xff0c;\u4f8b\u5982\u5c06a\u5bc4\u5b58\u5668\u7684\u503c\u8d4b\u503c\u7ed9b\u5bc4\u5b58\u5668&#xff0c;\u7528movq a b&#xff08;\u4ee58\u5b57\u8282\u4e3a\u4f8b&#xff09;\u3002\u6bd4\u5982\u5bf9\u5c40\u90e8\u53d8\u91cfi\u7684\u8d4b\u503c&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"61\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826cc0a3f.png\" width=\"247\" \/><\/p>\n<\/p>\n<h5 style=\"margin-left:.0001pt;text-align:left\"><\/h5>\n<p>3.3.6 \u53c2\u6570\u4f20\u9012\u2014\u2014\u5bf9main\u7684\u53c2\u6570argv\u7684\u4f20\u9012<\/p>\n<p>\u5728main\u51fd\u6570\u7684\u5f00\u59cb\u90e8\u5206&#xff0c;\u56e0\u4e3a\u540e\u9762\u8fd8\u4f1a\u4f7f\u7528\u5230%rbp\u6570\u7ec4&#xff0c;\u6240\u4ee5\u5148\u5c06%rbp&#xff08;\u5e27\u6307\u9488&#xff09;\u538b\u6808\u4fdd\u5b58\u8d77\u6765\u3002\u5728\u4e0b\u56fe\u7ea2\u6846\u533a\u57df,\u4ee3\u7801\u901a\u8fc7mov\u6307\u4ee4\u5c06\u6808\u6307\u9488\u51cf\u5c1132\u4f4d&#xff0c;\u7136\u540e\u5206\u522b\u5c06%rdi\u548c%rsi\u7684\u503c\u5b58\u5165\u6808\u4e2d\u3002\u7531\u6b64\u6211\u4eec\u77e5\u9053&#xff0c;%rbp-20\u548c%rbp-32\u7684\u4f4d\u7f6e\u5206\u522b\u5b58\u4e86argv\u6570\u7ec4\u548cargc\u7684\u503c\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"447\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826ccb9fa.png\" width=\"458\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.7 \u5bf9\u6570\u7ec4\u7684\u64cd\u4f5c<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5bf9\u6570\u7ec4\u7684\u64cd\u4f5c&#xff0c;\u90fd\u662f\u5148\u627e\u5230\u6570\u7ec4\u7684\u9996\u5730\u5740&#xff0c;\u7136\u540e\u52a0\u4e0a\u504f\u79fb\u91cf\u5373\u53ef\u3002\u4f8b\u5982\u5728main\u4e2d&#xff0c;\u8c03\u7528\u4e86argv[1]\u548cargv[2]&#xff0c;\u5728\u6c47\u7f16\u4ee3\u7801\u4e2d&#xff0c;\u6bcf\u6b21\u5c06%rbp-32\u7684\u7684\u503c\u5373\u6570\u7ec4\u9996\u5730\u5740\u4f20%rax&#xff0c;\u7136\u540e\u5c06%rax\u5206\u522b\u52a0\u4e0a\u504f\u79fb\u91cf24\u548c16&#xff0c;\u5f97\u5230\u4e86argv[1]\u548cargv[2]&#xff0c;\u518d\u5206\u522b\u5b58\u5165\u5bf9\u5e94\u7684\u5bc4\u5b58\u5668%rsi\u548c%rdx\u4f5c\u4e3a\u7b2c\u4e8c\u4e2a\u53c2\u6570\u548c\u7b2c\u4e09\u4e2a\u53c2\u6570&#xff0c;\u4e4b\u540e\u8c03\u7528printf\u51fd\u6570\u65f6\u4f7f\u7528\u3002\u8c03\u7528\u5b8cprintf\u540e\u540c\u6837&#xff0c;\u5728\u504f\u79fb\u91cf\u4e3a32\u65f6&#xff0c;\u53d6\u5f97argv[3]\u5e76\u5b58\u5165%rdi\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5728\u8c03\u7528\u51fd\u6570atoi\u4f7f\u7528\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"289\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005508-6847826ce4e0f.png\" width=\"314\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.8 \u5bf9\u51fd\u6570\u7684\u8c03\u7528\u4e0e\u8fd4\u56de<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">(1)main\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53c2\u6570\u4f20\u9012&#xff1a;\u8be5\u51fd\u6570\u7684\u53c2\u6570\u4e3aint argc,,char*argv[]\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u51fd\u6570\u8c03\u7528&#xff1a;\u901a\u8fc7\u4f7f\u7528call\u5185\u90e8\u6307\u4ee4\u8c03\u7528\u8bed\u53e5\u8fdb\u884c\u51fd\u6570\u8c03\u7528&#xff0c;\u5e76\u4e14\u5c06\u8981\u8c03\u7528\u7684\u51fd\u6570\u5730\u5740\u6570\u636e\u5199\u5165\u6808\u4e2d&#xff0c;\u7136\u540e\u81ea\u52a8\u8df3\u8f6c\u5230\u8fd9\u4e2a\u8c03\u7528\u51fd\u6570\u5185\u90e8\u3002main\u51fd\u6570\u91cc\u8c03\u7528\u4e86printf\u3001exit\u3001sleep\u51fd\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5c40\u90e8\u53d8\u91cf&#xff1a;\u4f7f\u7528\u4e86\u5c40\u90e8\u53d8\u91cfi\u7528\u4e8efor\u5faa\u73af\u3002\u5177\u4f53\u5c40\u90e8\u53d8\u91cf\u7684\u5730\u5740\u548c\u503c\u90fd\u5728\u524d\u9762\u9610\u8ff0\u8fc7\u3002<\/p>\n<p style=\"text-align:justify\">&#xff08;2&#xff09;printf\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u4ee3\u7801\u5982\u4e0b\u56fe&#xff1a;<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"96\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005509-6847826d062f6.png\" width=\"367\" \/><\/p>\n<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53c2\u6570\u4f20\u9012&#xff1a;printf\u51fd\u6570\u8c03\u7528\u53c2\u6570argv[1],argv[2]\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u51fd\u6570\u8c03\u7528&#xff1a;\u8be5\u51fd\u6570\u8c03\u7528\u4e86\u4e24\u6b21\u3002\u7b2c\u4e00\u6b21\u5c06\u5bc4\u5b58\u5668%rdi\u8bbe\u7f6e\u4e3a\u5f85\u4f20\u9012\u5b57\u7b26\u4e32&#034;\u7528\u6cd5&#xff1a;Hello\u5b66\u53f7\u00a0\u59d3\u540d\u00a0\u79d2\u6570&#xff01;\\\\n&#034;\u7684\u8d77\u59cb\u5730\u5740&#xff1b;\u7b2c\u4e8c\u6b21\u5c06\u5176\u8bbe\u7f6e\u4e3a\u201cHello %s \u00a0%s\\\\n\u201d\u7684\u8d77\u59cb\u5730\u5740\u3002\u5177\u4f53\u5df2\u5728\u524d\u9762\u8bb2\u8fc7\u3002\u4f7f\u7528\u5bc4\u5b58\u5668%rsi\u5b8c\u6210\u5bf9argv[1]\u7684\u4f20\u9012&#xff0c;\u7528%rdx\u5b8c\u6210\u5bf9argv[2]\u7684\u4f20\u9012\u3002<\/p>\n<p style=\"text-align:justify\">&#xff08;3&#xff09;exit\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u4ee3\u7801\u5982\u4e0b\u56fe&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"97\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005509-6847826d18777.png\" width=\"331\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;4&#xff09;atoi\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u4ee3\u7801\u5982\u4e0b\u56fe&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"81\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005509-6847826d27b9f.png\" width=\"231\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">atoi\u51fd\u6570\u5c06\u53c2\u6570argv[3]\u653e\u5165\u5bc4\u5b58\u5668%rdi\u4e2d\u7528\u4f5c\u53c2\u6570\u4f20\u9012&#xff0c;\u7b80\u5355\u4f7f\u7528call\u6307\u4ee4\u8c03\u7528\u3002atoi\u51fd\u6570\u7528\u4e8e\u5c06\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6574\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;5&#xff09;sleep\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u4ee3\u7801\u5982\u4e0b\u56fe&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"95\" src=\"2025-06-10fdy44iiywhd.png\" width=\"233\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4ee3\u7801\u5c06\u8f6c\u6362\u5b8c\u6210\u7684\u79d2\u6570\u4ece%eax\u4f20\u9012\u5230%edi\u4e2d&#xff0c;edi\u5b58\u653esleep\u7684\u53c2\u6570&#xff0c;\u518d\u4f7f\u7528call\u8c03\u7528\u3002Sleep\u51fd\u6570\u53ef\u4ee5\u8ba9\u7a0b\u5e8f\u4f11\u7720\u4e00\u6bb5\u65f6\u95f4\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;6&#xff09;getchar\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u4ee3\u7801\u5982\u4e0b\u56fe&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"89\" src=\"2025-06-10z2uqpeqlecc.png\" width=\"266\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">getchar\u51fd\u6570\u65e0\u53c2\u6570&#xff0c;\u7528\u4e8e\u83b7\u53d6\u5355\u4e2a\u5b57\u7b26\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;7&#xff09;puts\u51fd\u6570<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u4ee3\u7801\u5982\u4e0b\u56fe&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"87\" src=\"2025-06-10z52mezobyjp.png\" width=\"306\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728Og\u9009\u9879\u4e0b&#xff0c;\u5355\u72ec\u8f93\u51fa\u56fa\u5b9a\u5b57\u7b26\u4e32\u7684printf\u51fd\u6570\u88ab\u7f16\u8bd1\u5668\u4f18\u5316\u6210\u4e86puts\u51fd\u6570\u3002leaq .LC0(%rip), %rdi\u8fd9\u4e00\u884c\u5c06.LC0\u7684\u5730\u5740\u52a0\u8f7d\u5230%rdi\u5bc4\u5b58\u5668\u4e2d\u3002.LC0\u662f\u4e00\u4e2a\u5305\u542b\u8981\u8f93\u51fa\u7684\u5b57\u7b26\u4e32\u7684\u4f4d\u7f6e&#xff0c;\u5b83\u4f7f\u7528\u76f8\u5bf9\u5730\u5740\u5bfb\u5740\u3002\u5177\u4f53\u53ef\u89c1\u4e0b\u56fe\u7684\u4f2a\u4ee3\u7801\u6bb5\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"226\" src=\"2025-06-10ac10ztkatoa.png\" width=\"1114\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.3.9 for\u5faa\u73af<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"472\" src=\"2025-06-10nj1s5kxpfqh.png\" width=\"247\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">movq -32(%rbp), %rax&#xff1a;\u8fd9\u4e00\u884c\u5c06\u5b58\u50a8\u5728-32(%rbp)\u7684\u53d8\u91cf\u7684\u503c\u52a0\u8f7d\u5230%rax\u5bc4\u5b58\u5668\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">addq $24, %rax&#xff1a;\u8fd9\u4e00\u884c\u5c06%rax\u5bc4\u5b58\u5668\u4e2d\u7684\u503c\u589e\u52a024&#xff0c;\u7528\u4e8e\u83b7\u53d6arg[1]\u7684\u5730\u5740\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">movq (%rax), %rcx&#xff1a;\u8fd9\u4e00\u884cargv[1]\u52a0\u8f7d\u5230%rcx\u5bc4\u5b58\u5668\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">movq -32(%rbp), %rax&#xff1a;\u8fd9\u4e00\u884c\u91cd\u590d\u4e86\u7b2c2\u6b65\u7684\u64cd\u4f5c&#xff0c;\u91cd\u65b0\u52a0\u8f7d\u6570\u7ec4\u7684\u6307\u9488\u5230%rax\u5bc4\u5b58\u5668\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">addq $16, %rax&#xff1a;\u8fd9\u4e00\u884c\u589e\u52a0\u4e86%rax\u4e2d\u7684\u503c&#xff0c;\u901a\u5e38\u7528\u4e8e\u8bbf\u95ee\u6570\u7ec4\u4e2d\u7684\u53e6\u4e00\u4e2a\u5143\u7d20\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">movq (%rax), %rdx&#xff1a;\u8fd9\u4e00\u884c\u5c06\u6570\u7ec4\u4e2d\u7684\u53e6\u4e00\u4e2a\u5143\u7d20\u52a0\u8f7d\u5230%rdx\u5bc4\u5b58\u5668\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7d27\u63a5\u7740&#xff0c;\u7a0b\u5e8f\u91cd\u590d\u4e86\u4e0a\u8ff0\u6b65\u9aa4&#xff0c;\u83b7\u53d6\u4e86argv[2]\u548cargv[3]\u7684\u503c&#xff0c;\u5206\u522b\u5b58\u50a8\u5728%rdx\u548c%rsi\u5bc4\u5b58\u5668\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd9\u4e4b\u540e&#xff0c;\u51fd\u6570\u7ee7\u7eed\u6267\u884cfor\u5faa\u73af\u5185\u90e8\u7684\u5185\u5bb9\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">addl $1, -4(%rbp)&#xff1a;\u5c06\u5faa\u73af\u8ba1\u6570\u5668\u52a01&#xff0c;\u901a\u5e38\u662f\u901a\u8fc7\u4fee\u6539\u5b58\u50a8\u5728-4(%rbp)\u5904\u7684\u503c\u6765\u5b9e\u73b0\u3002\u63a5\u7740&#xff0c;\u51fd\u6570\u56de\u5230.L4\u6807\u8bb0\u5904&#xff0c;\u7ee7\u7eed\u6267\u884c\u5faa\u73af\u4f53\u3002\u8fd9\u4e9b\u6c47\u7f16\u6307\u4ee4\u91cd\u590d\u6267\u884c\u5faa\u73af\u4f53&#xff0c;\u76f4\u5230\u5faa\u73af\u6761\u4ef6\u4e0d\u518d\u6ee1\u8db3&#xff08;\u5373i &lt; 10&#xff09;\u3002<\/p>\n<h3 style=\"text-align:justify\">3.4 \u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd9\u4e00\u7ae0\u8be6\u7ec6\u5730\u4ecb\u7ecd\u4e86C\u7f16\u8bd1\u5668\u5982\u4f55\u628ahello.c\u6587\u4ef6\u8f6c\u6362\u6210hello.s\u6587\u4ef6\u7684\u8fc7\u7a0b&#xff0c;\u7b80\u8981\u8bf4\u660e\u4e86\u7f16\u8bd1\u7684\u542b\u4e49\u548c\u529f\u80fd&#xff0c;\u6f14\u793a\u4e86\u7f16\u8bd1\u7684\u6307\u4ee4&#xff0c;\u5e76\u901a\u8fc7\u5206\u6790\u751f\u6210\u7684hello.s\u6587\u4ef6\u4e2d\u7684\u6c47\u7f16\u4ee3\u7801&#xff0c;\u63a2\u8ba8\u4e86\u6570\u636e\u5904\u7406&#xff0c;\u51fd\u6570\u8c03\u7528&#xff0c;\u8d4b\u503c\u3001\u7b97\u672f\u3001\u5173\u7cfb\u7b49\u8fd0\u7b97\u4ee5\u53ca\u63a7\u5236\u8df3\u8f6c\u3001\u7c7b\u578b\u8f6c\u6362\u7b49\u65b9\u9762&#xff0c;\u6bd4\u8f83\u4e86\u6e90\u4ee3\u7801\u548c\u6c47\u7f16\u4ee3\u7801\u5206\u522b\u662f\u600e\u6837\u5b9e\u73b0\u8fd9\u4e9b\u64cd\u4f5c\u7684\u3002<\/p>\n<h2 style=\"text-align:center\">\u7b2c4\u7ae0 \u6c47\u7f16<\/h2>\n<h3 style=\"text-align:justify\">4.1 \u6c47\u7f16\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">4.1.1 \u6c47\u7f16\u7684\u6982\u5ff5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6c47\u7f16\u662f\u6307\u6c47\u7f16\u5668(assemble)\u5c06\u5305\u542b\u6c47\u7f16\u8bed\u8a00\u7684.s\u6587\u4ef6\u7ffb\u8bd1\u4e3a\u673a\u5668\u8bed\u8a00\u6307\u4ee4&#xff0c;\u5e76\u628a\u8fd9\u4e9b\u6307\u4ee4\u6253\u5305\u6210\u4e3a\u4e00\u4e2a\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6\u7684\u683c\u5f0f&#xff0c;\u751f\u6210\u76ee\u6807\u6587\u4ef6.o\u6587\u4ef6\u3002.o\u6587\u4ef6\u662f\u4e00\u4e2a\u4e8c\u8fdb\u5236\u6587\u4ef6&#xff0c;\u5305\u542bmain\u51fd\u6570\u7684\u6307\u4ee4\u7f16\u7801\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">4.1.2 \u6c47\u7f16\u7684\u4f5c\u7528<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u00a0\u00a0\u8ba1\u7b97\u673a\u53ea\u80fd\u8bc6\u522b\u5904\u7406\u673a\u5668\u6307\u4ee4\u7a0b\u5e8f&#xff0c;\u6c47\u7f16\u8fc7\u7a0b\u5c06\u6c47\u7f16\u8bed\u8a00\u7a0b\u5e8f\u7ffb\u8bd1\u4e3a\u4e86\u673a\u5668\u6307\u4ee4&#xff0c;\u8fdb\u4e00\u6b65\u5411\u8ba1\u7b97\u673a\u80fd\u591f\u6267\u884c\u64cd\u4f5c\u7684\u5f62\u5f0f\u8fc8\u8fdb&#xff0c;\u4fbf\u4e8e\u8ba1\u7b97\u673a\u76f4\u63a5\u8fdb\u884c\u5206\u6790\u5904\u7406\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b80\u5355\u7684\u6765\u8bf4&#xff0c;\u6c47\u7f16\u4e4b\u540e\u6211\u4eec\u80fd\u4ece\u6c47\u7f16\u4ee3\u7801\u5f97\u5230\u4e00\u4e2a\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6&#xff0c;\u4ee5\u4fbf\u540e\u7eed\u8fdb\u884c\u94fe\u63a5\u3002<\/p>\n<h3 style=\"text-align:justify\">4.2 \u5728Ubuntu\u4e0b\u6c47\u7f16\u7684\u547d\u4ee4<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728hello.s\u7684\u76ee\u5f55\u4e0b\u6253\u5f00\u7ec8\u7aef&#xff0c;\u8f93\u5165gcc -c hello.s -o hello.o\u5e76\u56de\u8f66&#xff0c;\u8fd9\u6837\u4fbf\u53ef\u4ee5\u751f\u6210hello.o\u76ee\u6807\u6587\u4ef6\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"169\" src=\"2025-06-10i5vwcohc35l.png\" width=\"1036\" \/><\/p>\n<h3 style=\"text-align:justify\">4.3 \u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807elf\u683c\u5f0f<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">4.3.1 elf\u5934<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7531\u4e8ehello.o\u6587\u4ef6\u662f\u4e00\u4e2a\u76ee\u6807\u6587\u4ef6&#xff0c;\u56e0\u6b64\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528vim\u6253\u5f00\u3002\u6211\u4eec\u5728\u7ec8\u7aef\u8f93\u5165readelf -h hello.o\u6765\u89e3\u6790elf\u6587\u4ef6\u5934&#xff0c;\u7ed3\u679c\u5982\u4e0b\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"559\" src=\"2025-06-10ybhcm5q5qc2.png\" width=\"1093\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">ELF\u5934\u4ee5\u4e00\u4e2a16\u5b57\u8282\u7684\u5e8f\u5217&#xff08;Magic&#xff0c;\u9b54\u6570&#xff09;\u5f00\u59cb&#xff0c;\u8fd9\u4e2a\u5e8f\u5217\u63cf\u8ff0\u4e86\u751f\u6210\u6587\u4ef6\u7684\u7cfb\u7edf\u7684\u5b57\u7684\u5927\u5c0f\u548c\u5b57\u8282\u987a\u5e8f\u3002ELF\u5934\u5269\u4e0b\u90e8\u5206\u7684\u4fe1\u606f\u5305\u542b\u5e2e\u52a9\u8fde\u63a5\u5668\u8bed\u6cd5\u5206\u6790\u548c\u89e3\u91ca\u76ee\u6807\u6587\u4ef6\u7684\u4fe1\u606f\u3002\u5176\u4e2d\u5305\u62ecELF\u5934\u7684\u5927\u5c0f\u3001\u76ee\u6807\u6587\u4ef6\u7684\u7c7b\u578b\u548c\u673a\u5668\u7c7b\u578b\u7b49\u3002\u4f8b\u5982\u4e0a\u56fe\u4e2d&#xff0c;Data\u8868\u793a\u4e86\u7cfb\u7edf\u91c7\u7528\u5c0f\u7aef\u6cd5&#xff0c;\u6587\u4ef6\u7c7b\u578bType\u4e3aREL&#xff08;\u53ef\u91cd\u5b9a\u4f4d\u6587\u4ef6&#xff09;&#xff0c;\u8282\u5934\u6570\u91cfNumber of section headers\u4e3a13\u4e2a\u7b49\u4fe1\u606f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">4.3.2 section\u5934<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u8f93\u5165readelf -S hello.o\u67e5\u770b\u8282\u5934&#xff0c;\u7ed3\u679c\u5982\u4e0b\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"820\" src=\"2025-06-10qyddspdbo3a.png\" width=\"832\" \/><\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u53ef\u4ee5\u53d1\u73b0&#xff0c;hello.o\u4e2d\u4e00\u5171\u670913\u4e2a\u8282&#xff0c;8\u4e2a\u91cd\u5b9a\u4f4d\u6761\u76ee&#xff0c;7\u4e2a\u5168\u5c40\u7b26\u53f7\u3002\u5728\u8fd9\u4e9b\u91cd\u5b9a\u4f4d\u6761\u76ee\u4e2d&#xff0c;\u6709\u4e24\u4e2a\u5bf9\u5e94rodata\u8282\u4e2d\u7684\u6570\u636e\u5730\u5740&#xff0c;\u663e\u7136\u5b83\u4eec\u662fprintf\u4f7f\u7528\u7684\u90a3\u4e24\u4e2a\u5b57\u7b26\u4e32\u5730\u5740\u3002\u53e6\u59166\u4e2a\u91cd\u5b9a\u4f4d\u6761\u76ee\u90fd\u662f\u88abcall\u6307\u4ee4\u8c03\u7528\u8fc7\u7684\u51fd\u6570\u5730\u5740\u3002<\/p>\n<p style=\"text-align:left\">\u5939\u5728ELF\u5934\u548c\u8282\u5934\u90e8\u8868\u4e4b\u95f4\u7684\u90fd\u4e3a\u8282&#xff0c;\u5305\u542b\u4e86\u6587\u4ef6\u4e2d\u51fa\u73b0\u7684\u5404\u4e2a\u8282\u7684\u8bed\u4e49&#xff0c;\u5305\u62ec\u8282\u7c7b\u578b\u3001\u4f4d\u7f6e\u548c\u5927\u5c0f\u7b49\u4fe1\u606f\u3002\u5404\u90e8\u5206\u542b\u4e49\u5982\u4e0b\u8868\u683c\u6240\u793a&#xff1a;<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u540d\u79f0<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5305\u542b\u5185\u5bb9\u542b\u4e49<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.text<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5df2\u7f16\u8bd1\u7a0b\u5e8f\u7684\u673a\u5668\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.rodata<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53ea\u8bfb\u6570\u636e&#xff0c;\u6bd4\u5982printf\u8bed\u53e5\u4e2d\u7684\u683c\u5f0f\u4e32\u548c\u5f00\u5173\u8bed\u53e5\u7684\u8df3\u8f6c\u8868\u3002ro\u662fRead-only(\u53ea\u8bfb)\u7684\u7b80\u79f0\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.data<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5df2\u521d\u59cb\u5316\u7684\u5168\u5c40\u53d8\u91cf\u548c\u9759\u6001C\u53d8\u91cf<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.bss&#xff08;Block Started by Symbol&#xff09;<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672a\u521d\u59cb\u5316\u7684\u5168\u5c40\u53d8\u91cf\u548c\u9759\u6001C\u53d8\u91cf&#xff0c;\u4ee5\u53ca\u6240\u6709\u521d\u59cb\u5316\u4e3a0\u7684\u5168\u5c40\u53d8\u91cf\u548c\u9759\u6001C\u53d8\u91cf\u3002\u5728\u76ee\u6807\u6587\u4ef6\u4e2d&#xff0c;\u8fd9\u4e2a\u8282\u5e76\u4e0d\u4f1a\u5360\u636e\u5b9e\u9645\u7a7a\u95f4&#xff0c;\u53ea\u662f\u4e00\u4e2a\u5360\u4f4d\u7b26&#xff0c;\u672a\u521d\u59cb\u5316\u53d8\u91cf\u5e76\u4e0d\u9700\u8981\u5360\u636e\u4efb\u4f55\u5b9e\u9645\u7684\u78c1\u76d8\u7a7a\u95f4&#xff0c;\u5728\u8fd0\u884c\u65f6\u518d\u4ece\u5185\u5b58\u5206\u914d\u53d8\u91cf&#xff0c;\u521d\u59cb\u503c\u4e3a0\u3002\u8fd9\u79cd\u5ef6\u8fdf\u5206\u914d\u7684\u673a\u5236\u53ef\u4ee5\u8282\u7701\u5927\u91cf\u5185\u5b58\u7a7a\u95f4&#xff0c;\u5c24\u5176\u662f\u5f53\u7a0b\u5e8f\u4e2d\u5b58\u5728\u5927\u91cf\u5168\u5c40\u6216\u9759\u6001\u53d8\u91cf\u65f6\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.symtab<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7b26\u53f7\u8868&#xff0c;\u5b58\u653e\u4e86\u7a0b\u5e8f\u4e2d\u5b9a\u4e49\u548c\u5f15\u7528\u7684\u51fd\u6570\u548c\u5168\u5c40\u53d8\u91cf\u7684\u4fe1\u606f\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.rel.text<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e00\u4e2a.tex\u8282\u4e2d\u4f4d\u7f6e\u7684\u5217\u8868<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.rel.data<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u88ab\u6a21\u5757\u5f15\u7528\u6216\u5b9a\u4e49\u7684\u6240\u6709\u5168\u5c40\u53d8\u91cf\u7684\u91cd\u5b9a\u4f4d\u4fe1\u606f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">.debug<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e00\u4e2a\u8c03\u8bd5\u7b26\u53f7\u8868&#xff0c;\u5176\u6761\u76ee\u662f\u7a0b\u5e8f\u4e2d\u5b9a\u4e49\u7684\u5c40\u90e8\u53d8\u91cf\u548c\u7c7b\u578b\u5b9a\u4e49&#xff0c;\u7a0b\u5e8f\u4e2d\u5b9a\u4e49\u548c\u5f15\u7528\u7684\u5168\u5c40\u53d8\u91cf&#xff0c;\u4ee5\u53ca\u539f\u59cb\u7684C\u6e90\u6587\u4ef6\u3002\u53ea\u6709\u4ee5-g\u9009\u9879\u8c03\u7528\u7f16\u8bd1\u5668\u9a71\u52a8\u7a0b\u5e8f\u65f6&#xff0c;\u624d\u80fd\u591f\u5f97\u5230\u8fd9\u5f20\u8868\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">.line<\/p>\n<\/td>\n<td style=\"width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u539f\u59cbC\u6e90\u7a0b\u5e8f\u4e2d\u7684\u884c\u53f7\u548c.text\u8282\u4e2d\u673a\u5668\u6307\u4ee4\u4e4b\u95f4\u7684\u6620\u5c04<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"width:218pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">.strtab\u548c.shstrtab<\/p>\n<\/td>\n<td style=\"width:218.05pt\">\n<p style=\"margin-left:.0001pt;text-align:left\">\u4e00\u4e2a\u5b57\u7b26\u4e32\u8868&#xff0c;\u5176\u5185\u5bb9\u5305\u62ec.symtab\u548c.debug\u8282\u4e2d\u7684\u7b26\u53f7\u8868&#xff0c;\u4ee5\u53ca\u8282\u5934\u90e8\u4e2d\u7684\u8282\u540d\u5b57(\u4fdd\u5b58\u5728shstrtab\u4e2d)\u3002\u5b57\u7b26\u4e32\u8868\u5c31\u662f\u4ee5null\u7ed3\u5c3e\u7684\u5b57\u7b26\u4e32\u5e8f\u5217\u3002<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;text-align:center\">\u88684.3.2-2 \u5404\u8282\u4fe1\u606f<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">4.3.3 \u7b26\u53f7\u8868<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u8f93\u5165\u547d\u4ee4readelf -s hello.o\u5e76\u56de\u8f66&#xff0c;\u7ed3\u679c\u5982\u4e0b\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"486\" src=\"2025-06-10jnyj30mwqbd.png\" width=\"799\" \/><\/p>\n<p style=\"text-align:left\">\u5728\u7b26\u53f7\u8868\u4e2d&#xff0c;Num\u4e3a\u67d0\u4e2a\u7b26\u53f7\u7684\u7f16\u53f7&#xff0c;Name\u662f\u7b26\u53f7\u7684\u540d\u79f0\u3002Size\u8868\u793a\u4ed6\u662f\u4e00\u4e2a\u4f4d\u4e8e.text\u8282\u4e2d\u504f\u79fb\u91cf\u4e3a0\u5904\u7684146\u5b57\u8282\u51fd\u6570\u3002Bind\u8868\u793a\u8fd9\u4e2a\u7b26\u53f7\u662f\u672c\u5730\u7684\u8fd8\u662f\u5168\u5c40\u7684&#xff0c;\u7531\u4e0a\u56fe\u53ef\u77e5main\u51fd\u6570\u540d\u79f0\u8fd9\u4e2a\u7b26\u53f7\u53d8\u91cf\u662f\u672c\u5730\u7684\u3002<\/p>\n<p style=\"text-align:left\">4.3.4 \u53ef\u91cd\u5b9a\u4f4d\u6bb5\u4fe1\u606f<\/p>\n<p style=\"text-align:left\">\u5728\u7ec8\u7aef\u8f93\u5165readelf -r hello.o\u5e76\u56de\u8f66\u53ef\u67e5\u770b\u53ef\u91cd\u5b9a\u4f4d\u6bb5\u4fe1\u606f&#xff0c;\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"text-align:left\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"631\" src=\"2025-06-10chjq22vwylw.png\" width=\"1155\" \/><\/p>\n<p style=\"text-align:left\">\u5728\u5217\u51fa\u7684\u4fe1\u606f\u4e2d&#xff0c;\u504f\u79fb\u91cf\u8868\u793a\u9700\u8981\u88ab\u4fee\u6539\u7684\u5f15\u7528\u7684\u8282\u504f\u79fb&#xff0c;\u7b26\u53f7\u503c\u6807\u8bc6\u88ab\u4fee\u6539\u5f15\u7528\u5e94\u8be5\u6307\u5411\u7684\u7b26\u53f7\u3002\u7c7b\u578b\u544a\u77e5\u8fde\u63a5\u5668\u5982\u4f55\u4fee\u6539\u65b0\u7684\u5f15\u7528&#xff0c;\u52a0\u6570\u662f\u4e00\u4e2a\u6709\u7b26\u53f7\u5e38\u6570&#xff0c;\u4e00\u4e9b\u7c7b\u578b\u7684\u91cd\u5b9a\u4f4d\u8981\u4f7f\u7528\u5b83\u5bf9\u88ab\u4fee\u6539\u7684\u5f15\u7528\u7684\u503c\u505a\u504f\u79fb\u8c03\u6574\u3002<\/p>\n<h3 style=\"text-align:justify\">4.4 Hello.o\u7684\u7ed3\u679c\u89e3\u6790<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u8f93\u5165readelf -d -r hello.o \u5e76\u56de\u8f66\u53ef\u5bf9hello.o\u6587\u4ef6\u8fdb\u884c\u53cd\u6c47\u7f16&#xff0c;\u5f97\u5230\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"990\" src=\"2025-06-10w4mret51hxs.png\" width=\"796\" \/><\/p>\n<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6211\u4eec\u4e0d\u96be\u53d1\u73b0&#xff0c;\u53cd\u6c47\u7f16\u5f97\u5230\u7684\u7ed3\u679c\u4e0ehello.s\u4e2d\u7684\u6c47\u7f16\u4ee3\u7801\u57fa\u672c\u4e00\u81f4&#xff0c;\u4f46\u662f\u8fd8\u662f\u5b58\u5728\u4e00\u4e9b\u51fa\u5165&#xff1a;\u5728\u6bcf\u6761\u6307\u4ee4\u7684\u524d\u9762\u51fa\u73b0\u4e86\u4e00\u7ec4\u7ec4\u753116\u8fdb\u5236\u6570\u5b57\u7ec4\u6210\u7684\u4ee3\u7801&#xff0c;\u8fd9\u5c31\u662f\u673a\u5668\u4ee3\u7801\u3002\u673a\u5668\u4ee3\u7801\u624d\u662f\u8ba1\u7b97\u673a\u771f\u6b63\u53ef\u4ee5\u8bc6\u522b\u7684\u8bed\u8a00\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd9\u4e9b\u673a\u5668\u4ee3\u7801\u662f\u4e8c\u8fdb\u5236\u673a\u5668\u6307\u4ee4\u7684\u96c6\u5408&#xff0c;\u6bcf\u4e00\u6761\u673a\u5668\u4ee3\u7801\u90fd\u5bf9\u5e94\u4e00\u6761\u673a\u5668\u6307\u4ee4\u3002\u6bcf\u4e00\u6761\u6c47\u7f16\u8bed\u8a00\u90fd\u53ef\u4ee5\u7528\u673a\u5668\u4e8c\u8fdb\u5236\u6570\u636e\u6765\u8868\u793a&#xff0c;\u6c47\u7f16\u8bed\u8a00\u4e2d\u7684\u64cd\u4f5c\u7801\u548c\u64cd\u4f5c\u6570\u4ee5\u4e00\u79cd\u76f8\u5f53\u4e8e\u6620\u5c04\u7684\u65b9\u5f0f\u548c\u673a\u5668\u8bed\u8a00\u8fdb\u884c\u5bf9\u5e94&#xff0c;\u4ece\u800c\u8ba9\u673a\u5668\u80fd\u591f\u771f\u6b63\u7406\u89e3\u4ee3\u7801\u7684\u542b\u4e49\u5e76\u4e14\u6267\u884c\u76f8\u5e94\u7684\u529f\u80fd\u3002\u673a\u5668\u4ee3\u7801\u4e0e\u6c47\u7f16\u4ee3\u7801\u4e0d\u540c\u7684\u5730\u65b9\u5728\u4e8e&#xff1a;<\/p>\n<li style=\"text-align:justify\">\u5206\u652f\u8df3\u8f6c\u65b9\u9762<\/li>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u6c47\u7f16\u8bed\u8a00\u4e2d\u4f7f\u7528\u8df3\u8f6c\u6307\u4ee4\u53ea\u9700\u8981\u5728\u540e\u9762\u52a0\u4e0a\u6807\u8bc6\u7b26\u4fbf\u53ef\u4ee5\u8df3\u8f6c\u5230\u6807\u8bc6\u7b26\u6240\u5728\u7684\u4f4d\u7f6e&#xff0c;\u800c\u673a\u5668\u8bed\u8a00\u7ecf\u8fc7\u7ffb\u8bd1\u76f4\u63a5\u901a\u8fc7\u957f\u5ea6\u4e3a\u4e00\u4e2a\u5b57\u8282\u7684PC&#xff08;Program Counter,\u7a0b\u5e8f\u8ba1\u6570\u5668&#xff09;\u76f8\u5bf9\u5730\u5740\u8fdb\u884c\u8df3\u8f6c\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:218pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"84\" src=\"2025-06-10bap31nv1cvd.png\" width=\"508\" \/><\/td>\n<td style=\"vertical-align:top;width:218.05pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"75\" src=\"2025-06-10ruos2v4wc02.png\" width=\"466\" \/><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" style=\"vertical-align:top;width:436.05pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u8df3\u8f6c\u81f3.L3\u7684\u4ee3\u7801\u5bf9\u6bd4<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u5de6\u4fa7\u4e3a\u53cd\u6c47\u7f16\u4ee3\u7801&#xff0c;\u53f3\u4fa7\u4e3a\u6c47\u7f16\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2.\u51fd\u6570\u8c03\u7528\u65b9\u9762<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u6c47\u7f16\u4ee3\u7801hello.s\u4e2d&#xff0c;\u51fd\u6570\u8c03\u7528\u76f4\u63a5\u6807\u4e0a\u4e86\u51fd\u6570\u7684\u540d\u79f0\u3002\u3002\u800c\u5728\u53cd\u6c47\u7f16\u4ee3\u7801\u4e2d&#xff0c;call\u76ee\u6807\u5730\u5740\u662f\u5f53\u524d\u6307\u4ee4\u7684\u4e0b\u4e00\u6761\u6307\u4ee4\u5730\u5740\u3002\u8fd9\u662f\u56e0\u4e3ahello.c\u4e2d\u8c03\u7528\u7684\u51fd\u6570\u90fd\u662f\u5171\u4eab\u5e93&#xff08;\u5982stdio.h,stdlib.h&#xff09;\u4e2d\u7684\u51fd\u6570&#xff0c;\u5982puts&#xff0c;exit&#xff0c;printf&#xff0c;atoi&#xff0c;sleep\u7b49&#xff0c;\u9700\u8981\u7b49\u5f85\u94fe\u63a5\u5668\u8fdb\u884c\u94fe\u63a5\u4e4b\u540e\u624d\u80fd\u786e\u5b9a\u54cd\u5e94\u51fd\u6570\u7684\u5730\u5740\u3002\u56e0\u6b64&#xff0c;\u673a\u5668\u8bed\u8a00\u4e2d&#xff0c;\u5bf9\u4e8e\u8fd9\u79cd\u4e0d\u786e\u5b9a\u5730\u5740\u7684\u8c03\u7528&#xff0c;\u4f1a\u5148\u5c06\u4e0b\u4e00\u6761\u6307\u4ee4\u7684\u76f8\u5bf9\u5730\u5740\u5168\u90e8\u8bbe\u7f6e\u4e3a0&#xff0c;\u7136\u540e\u5728.rel.text\u8282\u4e2d\u4e3a\u5176\u6dfb\u52a0\u91cd\u5b9a\u4f4d\u6761\u76ee&#xff0c;\u7b49\u5f85\u94fe\u63a5\u65f6\u786e\u5b9a\u5730\u5740\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:218.1pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"145\" src=\"2025-06-10cswoqwh4dfa.png\" width=\"511\" \/><\/td>\n<td style=\"vertical-align:top;width:217.95pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"150\" src=\"2025-06-10gxjbmqctdnm.png\" width=\"460\" \/><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" style=\"vertical-align:top;width:436.05pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u8c03\u7528getchar\u51fd\u6570\u7684\u5bf9\u6bd4<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u5de6\u4fa7\u4e3a\u53cd\u6c47\u7f16\u4ee3\u7801&#xff0c;\u53f3\u4fa7\u4e3a\u6c47\u7f16\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.\u4f2a\u6307\u4ee4\u90e8\u5206<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53cd\u6c47\u7f16\u4ee3\u7801\u4e2d&#xff0c;\u539f\u6765\u51fa\u73b0\u5728\u6c47\u7f16\u4ee3\u7801\u5f00\u5934\u7684\u4f2a\u6307\u4ee4\u5168\u90e8\u6d88\u5931\u4e86\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"width:455.55pt\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:214.75pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"111\" src=\"2025-06-10oj5liexq3tm.png\" width=\"499\" \/><\/td>\n<td style=\"vertical-align:top;width:240.8pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"144\" src=\"2025-06-10p3xfgss5edl.png\" width=\"574\" \/><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" style=\"vertical-align:top;width:455.55pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u4ee3\u7801\u5f00\u5934\u5bf9\u6bd4<\/p>\n<p style=\"margin-left:.0001pt;text-align:center\">\u5de6\u4fa7\u4e3a\u53cd\u6c47\u7f16\u4ee3\u7801&#xff0c;\u53f3\u4fa7\u4e3a\u6c47\u7f16\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 4.\u7acb\u5373\u6570\u90e8\u5206<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u539f\u672c\u5341\u8fdb\u5236\u7684\u7acb\u5373\u6570\u90fd\u53d8\u6210\u4e86\u4e8c\u8fdb\u5236\u3002\u8fd9\u4e2a\u5f88\u597d\u7406\u89e3&#xff0c;\u8f93\u51fa\u7684\u6587\u4ef6\u662f\u4e8c\u8fdb\u5236\u7684&#xff0c;\u5bf9\u4e8eobjdump\u6765\u8bf4&#xff0c;\u76f4\u63a5\u5c06\u4e8c\u8fdb\u5236\u8f6c\u5316\u4e3a\u5341\u516d\u8fdb\u5236\u6bd4\u8f83\u65b9\u4fbf&#xff0c;\u4e5f\u6709\u5229\u4e8e\u7a0b\u5e8f\u5458\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d\u89c2\u5bdf\u4ee3\u7801\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:222.3pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"55\" src=\"2025-06-10g4mgrqr0bzw.png\" width=\"522\" \/><\/td>\n<td style=\"vertical-align:top;width:213.75pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"55\" src=\"2025-06-10zp5w2ido5m5.png\" width=\"493\" \/><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\" style=\"vertical-align:top;width:436.05pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u5de6\u4fa7\u4e3a\u53cd\u6c47\u7f16\u4ee3\u7801&#xff0c;\u53f3\u4fa7\u4e3a\u6c47\u7f16\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 style=\"text-align:justify\">4.5 \u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:0pt;text-align:justify\">\u672c\u7ae0\u5bf9\u6c47\u7f16\u7684\u6982\u5ff5\u3001\u4f5c\u7528\u3001\u53ef\u91cd\u5b9a\u5411\u76ee\u6807\u6587\u4ef6\u7684\u7ed3\u6784\u53ca\u5bf9\u5e94\u53cd\u6c47\u7f16\u4ee3\u7801\u7b49\u8fdb\u884c\u4e86\u8f83\u4e3a\u8be6\u7ec6\u7684\u4ecb\u7ecd\u3002\u7ecf\u8fc7\u6c47\u7f16\u9636\u6bb5&#xff0c;\u6c47\u7f16\u8bed\u8a00\u4ee3\u7801\u8f6c\u5316\u4e3a\u673a\u5668\u8bed\u8a00&#xff0c;\u751f\u6210\u7684\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6(hello.o)\u4e3a\u968f\u540e\u7684\u94fe\u63a5\u9636\u6bb5\u505a\u597d\u4e86\u51c6\u5907\u3002\u5b8c\u6210\u672c\u7ae0\u5185\u5bb9\u7684\u8fc7\u7a0b\u52a0\u6df1\u4e86\u6211\u5bf9\u6c47\u7f16\u8fc7\u7a0b\u3001ELF\u683c\u5f0f\u4ee5\u53ca\u91cd\u5b9a\u4f4d\u7684\u7406\u89e3\u3002<\/p>\n<h2 style=\"text-align:center\">\u7b2c5\u7ae0 \u94fe\u63a5<\/h2>\n<h3 style=\"text-align:justify\">5.1 \u94fe\u63a5\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">5.1.1 \u94fe\u63a5\u7684\u6982\u5ff5<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u94fe\u63a5\u662f\u5c06\u5404\u79cd\u4ee3\u7801\u548c\u6570\u636e\u7247\u6bb5\u548c\u641c\u96c6\u5e76\u7ec4\u6210\u6210\u4e3a\u4e00\u4e2a\u5355\u4e00\u6587\u4ef6\u7684\u8fc7\u7a0b&#xff0c;\u8fd9\u4e2a\u6587\u4ef6\u53ef\u88ab\u52a0\u8f7d&#xff08;\u590d\u5236 &#xff09;\u5230\u5185\u5b58\u5e76\u6267\u884c\u3002\u94fe\u63a5\u53ef\u4ee5\u5728\u7f16\u8bd1\u65f6&#xff0c;\u4e5f\u5c31\u662f\u5728\u6e90\u4ee3\u7801\u88ab\u7ffb\u8bd1\u6210\u673a\u5668\u4ee3\u7801\u65f6\u76f4\u63a5\u6267\u884c&#xff1b;\u4e5f\u53ef\u4ee5\u6267\u884c\u4e8e\u52a0\u8f7d\u65f6&#xff0c;\u4e5f\u5c31\u662f\u5728\u7a0b\u5e8f\u88ab\u8bb0\u8f7d\u5668\u52a0\u8f7d\u5230\u5185\u5b58\u5e76\u6267\u884c\u65f6&#xff1b;\u751a\u81f3\u6267\u884c\u4e8e\u8fd0\u884c\u65f6&#xff0c;\u4e5f\u5c31\u662f\u7531\u5e94\u7528\u7a0b\u5e8f\u6765\u6267\u884c\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">5.1.2 \u94fe\u63a5\u7684\u4f5c\u7528<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u94fe\u63a5\u53ef\u4ee5\u5c06\u7a0b\u5e8f\u8c03\u7528\u7684\u5404\u79cd\u9759\u6001\u94fe\u63a5\u5e93\u548c\u52a8\u6001\u8fde\u63a5\u5e93\u6574\u5408\u5230\u4e00\u8d77&#xff0c;\u5b8c\u5584\u91cd\u5b9a\u4f4d\u76ee\u5f55&#xff0c;\u4f7f\u4e4b\u6210\u4e3a\u4e00\u4e2a\u53ef\u8fd0\u884c\u7684\u7a0b\u5e8f\u3002\u540c\u65f6&#xff0c;\u94fe\u63a5\u7684\u4e3b\u8981\u4f5c\u7528\u5c31\u662f\u4f7f\u5f97\u5206\u79bb\u7f16\u8bd1\u6210\u4e3a\u53ef\u80fd&#xff0c;\u4ece\u800c\u4e0d\u9700\u8981\u5c06\u4e00\u4e2a\u5927\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\u7ec4\u7ec7\u6210\u4e00\u4e2a\u5de8\u5927\u7684\u6e90\u6587\u4ef6&#xff0c;\u800c\u662f\u53ef\u4ee5\u5c06\u5176\u5206\u89e3\u6210\u66f4\u5c0f\u7684\u3001\u66f4\u597d\u7ba1\u7406\u7684\u6a21\u5757&#xff0c;\u53ef\u4ee5\u72ec\u7acb\u7684\u4fee\u6539\u548c\u7f16\u8bd1\u8fd9\u4e9b\u6a21\u5757\u3002<\/p>\n<h3 style=\"text-align:justify\">5.2 \u5728Ubuntu\u4e0b\u94fe\u63a5\u7684\u547d\u4ee4<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u4e2d&#xff0c;\u8f93\u5165ld -o hello -dynamic-linker \/lib64\/ld-linux-x86-64.so.2 \/usr\/lib\/x86_64-linux-gnu\/crt1.o \/usr\/lib\/x86_64-linux-gnu\/crti.o hello.o \/usr\/lib\/x86_64-linux-gnu\/libc.so \/usr\/lib\/x86_64-linux-gnu\/crtn.o\u5e76\u56de\u8f66&#xff0c;\u7ed3\u679c\u5982\u4e0b\u56fe\u6240\u793a&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"490\" src=\"2025-06-10oi2hbkalcq5.png\" width=\"691\" \/><\/p>\n<h3 style=\"text-align:justify\">5.3 \u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6hello\u7684\u683c\u5f0f<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u7684\u683c\u5f0f\u7c7b\u4f3c\u4e8e\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6&#xff08;hello.o&#xff09;\u7684\u683c\u5f0f,\u4f46\u7a0d\u6709\u4e0d\u540c\u3002ELF\u5934\u4e2d\u5b57\u6bb5e_entry\u7ed9\u51fa\u6267\u884c\u7a0b\u5e8f\u65f6\u7684\u7b2c\u4e00\u6761\u6307\u4ee4\u7684\u5730\u5740&#xff0c;\u800c\u5728\u53ef\u91cd\u5b9a\u4f4d\u6587\u4ef6\u4e2d&#xff0c;\u6b64\u5b57\u6bb5\u4e3a0\u3002\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u591a\u4e86\u4e00\u4e2a\u7a0b\u5e8f\u5934\u8868&#xff0c;\u4e5f\u79f0\u4e3a\u6bb5\u5934\u8868&#xff0c;\u662f\u4e00\u4e2a\u7ed3\u6784\u6570\u7ec4\u3002\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u8fd8\u591a\u4e86\u4e00\u4e2a.init\u8282&#xff0c;\u7528\u4e8e\u5b9a\u4e49_init\u51fd\u6570&#xff0c;\u8be5\u51fd\u6570\u7528\u6765\u6267\u884c\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u5f00\u59cb\u6267\u884c\u65f6\u7684\u521d\u59cb\u5316\u5de5\u4f5c\u3002\u56e0\u4e3a\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u4e0d\u9700\u8981\u91cd\u5b9a\u4f4d&#xff0c;\u6240\u4ee5\u6bd4\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6\u5c11\u4e86\u4e24\u4e2a.rel\u8282\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e0e\u7b2c\u56db\u7ae0\u4f7f\u7528\u7684\u65b9\u6cd5\u76f8\u4f3c&#xff0c;\u6211\u4eec\u4f9d\u65e7\u53ef\u4ee5\u4f7f\u7528readelf\u67e5\u770bhello\u6587\u4ef6\u7684ELF\u5934&#xff0c;\u8282\u5934\u90e8\u8868&#xff0c;\u7b26\u53f7\u8868\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">5.3.1 ELF\u5934<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165readelf -h hello\u5e76\u56de\u8f66&#xff0c;\u67e5\u770bhello\u6587\u4ef6\u7684ELF\u5934&#xff0c;\u5982\u4e0b\u56fe\u6240\u793a&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"667\" src=\"2025-06-10cxapact2ejk.png\" width=\"964\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6211\u4eec\u4e0d\u96be\u53d1\u73b0&#xff0c;hello\u7684ELF\u5934\u4e2dType\u5904\u663e\u793a\u7684\u662fEXEC&#xff0c;\u8868\u793a\u65f6\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6&#xff0c;\u8fd9\u4e0ehello.o\u4e0d\u540c\u3002hello\u4e2d\u7684\u8282\u7684\u6570\u91cf\u4e3a30\u4e2a\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">5.3.2 Section\u5934<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165readelf -S hello\u5e76\u56de\u8f66&#xff0c;\u67e5\u770bhello\u6587\u4ef6\u7684Section\u5934&#xff0c;\u5982\u4e0b\u56fe\u6240\u793a&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"808\" src=\"2025-06-10dlkrfkinttw.png\" width=\"531\" \/><\/p>\n<p style=\"text-align:left\">\u00a0\u00a0Section\u8868\u5bf9hello\u4e2d\u6240\u6709\u4fe1\u606f\u8fdb\u884c\u4e86\u58f0\u660e&#xff0c;\u5305\u62ec\u4e86\u5927\u5c0f\u3001\u504f\u79fb\u91cf\u3001\u8d77\u59cb\u5730\u5740\u4ee5\u53ca\u6570\u636e\u5bf9\u9f50\u65b9\u5f0f\u7b49\u4fe1\u606f\u3002\u6839\u636e\u59cb\u5730\u5740\u548c\u5927\u5c0f&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u8ba1\u7b97\u8282\u5934\u90e8\u8868\u4e2d\u7684\u6bcf\u4e2a\u8282\u6240\u5728\u7684\u533a\u57df\u3002<\/p>\n<h3 style=\"text-align:justify\">5.4 hello\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6211\u4eec\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165edb\u5e76\u56de\u8f66&#xff0c;\u6253\u5f00edb\u754c\u9762&#xff0c;\u5728File-Open\u4e2d\u9009\u62e9hello\u6587\u4ef6&#xff0c;\u70b9\u51fbopen&#xff0c;\u754c\u9762\u663e\u793a\u5982\u4e0b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"553\" src=\"2025-06-102uxe322rc3j.png\" width=\"1032\" \/><\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230&#xff0c;hello\u7684\u53ef\u6267\u884c\u90e8\u5206&#xff08;\u4ee3\u7801\u6bb5&#xff09;\u8d77\u59cb\u5730\u5740\u4e3a0x400000&#xff0c;\u7ed3\u675f\u5730\u5740\u4e3a0x400ff0\u3002\u00a0<\/p>\n<p>\u00a0<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"148\" src=\"2025-06-10dhq0vnvhbly.png\" width=\"649\" \/><\/p>\n<p>\u75315.3\u8282\u6211\u4eec\u53c8\u53ef\u4ee5\u5f97\u77e5&#xff0c;.interp\u6bb5\u7684\u8d77\u59cb\u5730\u5740\u4e3a400200\u3002\u4f7f\u7528edb\u67e5\u8be2\u53ef\u5f97\u5230\u5982\u4e0b\u7ed3\u679c\u3002\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"183\" src=\"2025-06-105cf15gs5r50.png\" width=\"639\" \/><\/p>\n<p>\u75315.3\u8282\u6211\u4eec\u53ef\u5f97\u77e5&#xff0c;.init\u7684\u8d77\u59cb\u5730\u5740\u4e3a0x4004c0&#xff0c;\u5728edb\u4e2d\u67e5\u8be2\u5730\u5740\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u56fe\u7684\u7ed3\u679c&#xff1a;\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"100\" src=\"2025-06-10f2sl553mgpd.png\" width=\"637\" \/><\/p>\n<p>\u75315.3\u8282\u6211\u4eec\u53ef\u5f97\u77e5&#xff0c;.text\u7684\u8d77\u59cb\u5730\u5740\u4e3a0x400550&#xff0c;\u5728edb\u4e2d\u67e5\u8be2\u5730\u5740\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u56fe\u7684\u7ed3\u679c&#xff1a;\u00a0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"292\" src=\"2025-06-10bowkdylscw0.png\" width=\"664\" \/><\/p>\n<p>\u75315.3\u8282\u6211\u4eec\u53ef\u5f97\u77e5&#xff0c;.rodata\u7684\u8d77\u59cb\u5730\u5740\u4e3a0x4006a0&#xff0c;\u5728edb\u4e2d\u67e5\u8be2\u5730\u5740\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u56fe\u7684\u7ed3\u679c&#xff1a;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"124\" src=\"2025-06-10vqiracq5mfw.png\" width=\"675\" \/>\u00a0<\/p>\n<p>\u75315.3\u8282\u6211\u4eec\u53ef\u5f97\u77e5&#xff0c;.eh_frame\u7684\u8d77\u59cb\u5730\u5740\u4e3a0x4006a0&#xff0c;\u5728edb\u4e2d\u67e5\u8be2\u5730\u5740\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u56fe\u7684\u7ed3\u679c&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"204\" src=\"2025-06-10wpe2q4tgafp.png\" width=\"654\" \/><\/p>\n<\/p>\n<h3 style=\"text-align:justify\">5.5 \u94fe\u63a5\u7684\u91cd\u5b9a\u4f4d\u8fc7\u7a0b\u5206\u6790<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u7ec8\u7aef\u8f93\u5165\u547d\u4ee4objdump -d -r hello\u5e76\u56de\u8f66&#xff0c;\u67e5\u770bhello\u53ef\u6267\u884c\u6587\u4ef6\u7684\u53cd\u6c47\u7f16\u6761\u76ee&#xff0c;\u7ed3\u679c\u5982\u4e0b&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"502\" src=\"2025-06-10fnto0daod3k.png\" width=\"915\" \/><\/p>\n<p style=\"text-align:left\">\u6211\u4eec\u53ef\u4ee5\u89c2\u5bdf\u5230&#xff0c;hello\u7684\u53cd\u6c47\u7f16\u4ee3\u7801\u4e0ehello.o\u7684\u8fd4\u6c47\u7f16\u4ee3\u7801\u5728\u7ed3\u6784\u548c\u8bed\u6cd5\u4e0a\u662f\u57fa\u672c\u76f8\u540c\u7684&#xff0c;\u53ea\u4e0d\u8fc7hello\u7684\u53cd\u6c47\u7f16\u4ee3\u7801\u591a\u4e86\u975e\u5e38\u591a\u7684\u5185\u5bb9&#xff0c;\u6211\u4eec\u901a\u8fc7\u6bd4\u8f83\u4e0d\u540c\u6765\u770b\u4e00\u4e0b\u533a\u522b&#xff1a;<\/p>\n<p style=\"text-align:left\">1.\u865a\u62df\u5730\u5740\u4e0d\u540c&#xff0c;hello.o\u7684\u53cd\u6c47\u7f16\u4ee3\u7801\u865a\u62df\u5730\u5740\u4ece0\u5f00\u59cb&#xff0c;\u800chello\u7684\u53cd\u6c47\u7f16\u4ee3\u7801\u865a\u62df\u5730\u5740\u4ece0x400000\u5f00\u59cb\u3002\u8fd9\u662f\u56e0\u4e3ahello.o\u5728\u94fe\u63a5\u4e4b\u524d\u53ea\u80fd\u7ed9\u51fa\u76f8\u5bf9\u5730\u5740&#xff0c;\u800chello\u5728\u94fe\u63a5\u4e4b\u540e\u5f97\u5230\u7684\u662f\u7edd\u5bf9\u5730\u5740\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" style=\"width:441.25pt\">\n<tbody>\n<tr>\n<td style=\"vertical-align:top;width:225.2pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"132\" src=\"2025-06-10trhy204jkkk.png\" width=\"502\" \/><\/td>\n<td style=\"vertical-align:top;width:216.05pt\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"139\" src=\"2025-06-104lccppmzgwj.png\" width=\"456\" \/><\/td>\n<\/tr>\n<tr>\n<td style=\"vertical-align:top;width:225.2pt\">\n<p style=\"text-align:center\">hello\u7684\u53cd\u6c47\u7f16\u7ed3\u679c<\/p>\n<\/td>\n<td style=\"vertical-align:top;width:216.05pt\">\n<p style=\"text-align:center\">hello.o\u7684\u53cd\u6c47\u7f16\u7ed3\u679c<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align:left\">2.\u53cd\u6c47\u7f16\u8282\u6570\u4e0d\u540c&#xff0c;hello.o\u53ea\u6709.text\u8282&#xff0c;\u91cc\u9762\u53ea\u6709main\u51fd\u6570\u7684\u53cd\u6c47\u7f16\u4ee3\u7801\u3002\u800chello\u5728main\u51fd\u6570\u4e4b\u524d\u52a0\u4e0a\u4e86\u94fe\u63a5\u8fc7\u7a0b\u4e2d\u91cd\u5b9a\u4f4d\u800c\u52a0\u5165\u7684\u5404\u79cd\u5728hello\u4e2d\u88ab\u8c03\u7528\u7684\u51fd\u6570\u3001\u6570\u636e&#xff0c;\u589e\u52a0\u4e86.init&#xff0c;.plt&#xff0c;.plt.sec\u7b49\u8282\u7684\u53cd\u6c47\u7f16\u4ee3\u7801\u3002<\/p>\n<p style=\"text-align:left\">3.\u8df3\u8f6c\u6307\u4ee4\u4e0d\u540c&#xff0c;hello.o\u4e2d\u7684\u8df3\u8f6c\u6307\u4ee4\u540e\u52a0\u7684\u4e3b\u8981\u662f\u6c47\u7f16\u4ee3\u7801\u5757\u524d\u7684\u6807\u53f7&#xff0c;\u800chello\u4e2d\u7684\u8df3\u8f6c\u6307\u4ee4\u540e\u52a0\u7684\u5219\u662f\u5177\u4f53\u7684\u5730\u5740&#xff0c;\u4f46\u76f8\u5bf9\u5730\u5740\u6ca1\u6709\u53d1\u751f\u53d8\u5316\u3002<\/p>\n<p style=\"text-align:left\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"198\" src=\"2025-06-10wg1jv2lgbzd.png\" width=\"973\" \/><\/p>\n<\/p>\n<h3 style=\"text-align:justify\">5.6 hello\u7684\u6267\u884c\u6d41\u7a0b<\/h3>\n<p style=\"margin-left:0pt;text-align:justify\">1.\u4f7f\u7528edb\u6267\u884chello&#xff0c;\u9996\u5148&#xff0c;\u6700\u521d\u7684\u7a0b\u5e8f\u5730\u5740\u4f1a\u57280x7fa4:917dc090\u5904&#xff0c;\u8fd9\u91cc\u662fhello\u4f7f\u7528\u7684\u52a8\u6001\u94fe\u63a5\u5e93ld-2.2.27.so\u7684\u5165\u53e3\u70b9_dl_start&#xff1a;<\/p>\n<p style=\"margin-left:0pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"547\" src=\"2025-06-10fdrxhhwkicd.png\" width=\"751\" \/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/p>\n<p style=\"text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a02.\u7136\u540e&#xff0c;\u7a0b\u5e8f\u8df3\u8f6c\u5230_dl_init&#xff0c;\u5728\u7ecf\u8fc7\u4e86\u4e00\u7cfb\u5217\u521d\u59cb\u5316\u540e&#xff0c;\u8df3\u5230hello\u7684\u7a0b \u5e8f\u5165\u53e3\u70b9_start&#xff1b;<\/p>\n<p style=\"text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3.\u7136\u540e\u7a0b\u5e8f\u901a\u8fc7call\u6307\u4ee4\u8df3\u5230\u52a8\u6001\u94fe\u63a5\u5e93ld-2.27.so\u7684_libc_start_main \u5904&#xff0c;\u8fd9\u4e2a\u51fd\u6570\u4f1a\u8fdb\u884c\u4e00\u4e9b\u5fc5\u8981\u7684\u521d\u59cb\u5316&#xff0c;\u5e76\u8d1f\u8d23\u8c03\u7528main\u51fd\u6570&#xff1b;<\/p>\n<p style=\"text-align:justify\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a04. \u4e0b\u4e00\u6b65&#xff0c;\u7a0b\u5e8f\u8c03\u7528\u52a8\u6001\u94fe\u63a5\u5e93\u4e2d\u7684__cxa_atexit\u51fd\u6570&#xff0c;\u5b83\u4f1a\u8bbe\u7f6e\u5728\u7a0b\u5e8f\u7ed3\u675f\u65f6\u9700\u8981\u8c03\u7528\u7684\u51fd\u6570\u8868&#xff1b;<\/p>\n<p style=\"margin-left:21pt;text-align:justify\">5. \u7136\u540e\u8fd4\u56de\u5230__libc_start_main\u7ee7\u7eed&#xff0c;\u7136\u540e\u8c03\u7528hello\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u7684__libc_csu_init\u51fd\u6570&#xff0c;\u8fd9\u51fd\u6570\u662f\u7531\u9759\u6001\u5e93\u5f15\u5165\u7684&#xff0c;\u4e5f\u662f\u505a\u4e00\u4e9b\u521d\u59cb\u5316\u7684\u5de5\u4f5c&#xff1b;<\/p>\n<p style=\"margin-left:21pt;text-align:justify\">6. \u7136\u540e\u7a0b\u5e8f\u8fd4\u56de\u5230__libc_start_main\u7ee7\u7eed&#xff0c;\u7d27\u63a5\u7740\u7a0b\u5e8f\u8c03\u7528\u52a8\u6001\u94fe\u63a5\u5e93\u91cc\u7684_setjmp\u51fd\u6570&#xff0c;\u8bbe\u7f6e\u4e00\u4e9b\u975e\u672c\u5730\u8df3\u8f6c&#xff1b;<\/p>\n<p style=\"margin-left:21pt;text-align:justify\">7.\u7136\u540e\u8fd4\u56de\u5230__libc_start_main\u7ee7\u7eed&#xff0c;\u6b63\u5f0f\u5f00\u59cb\u8c03\u7528main\u51fd\u6570&#xff1b;<\/p>\n<p style=\"margin-left:21pt;text-align:justify\">8. \u7531\u4e8e\u6211\u4eec\u5728edb\u8fd0\u884chello\u7684\u65f6\u5019\u5e76\u672a\u7ed9\u51fa\u989d\u5916\u7684\u547d\u4ee4\u884c\u53c2\u6570&#xff0c;\u56e0\u6b64\u5b83\u4f1a\u5728\u7b2c\u4e00\u4e2aif\u5904\u901a\u8fc7exit(1)\u76f4\u63a5\u7ed3\u675f\u7a0b\u5e8f&#xff1b;<\/p>\n<p style=\"margin-left:21pt;text-align:justify\">9. \u901a\u8fc7hello\u672c\u8eab\u643a\u5e26\u7684exit\u51fd\u6570&#xff0c;\u7a0b\u5e8f\u4f1a\u8df3\u8f6c&#xff1b;<\/p>\n<p style=\"margin-left:21pt;text-align:justify\">10. \u4e4b\u540e&#xff0c;\u5728\u8fdb\u884c\u4e86\u82e5\u5e72\u64cd\u4f5c\u540e&#xff0c;\u7a0b\u5e8f\u9000\u51fa\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"140\" src=\"2025-06-10kpsodvyjerb.png\" width=\"344\" \/><\/p>\n<h3 style=\"text-align:justify\">5.7 Hello\u7684\u52a8\u6001\u94fe\u63a5\u5206\u6790<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7a0b\u5e8f\u8c03\u7528\u4e00\u4e2a\u6709\u5171\u4eab\u5e93\u5b9a\u4e49\u7684\u51fd\u6570\u65f6&#xff0c;\u7f16\u8bd1\u5668\u65e0\u6cd5\u9884\u6d4b\u51fd\u6570\u5728\u8fd0\u884c\u65f6\u7684\u5177\u4f53\u5730\u5740&#xff0c;\u56e0\u4e3a\u5b9a\u4e49\u8fd9\u4e2a\u51fd\u6570\u7684\u5171\u4eab\u6a21\u5757\u53ef\u80fd\u53ef\u4ee5\u88ab\u52a0\u8f7d\u5230\u4efb\u4f55\u4f4d\u7f6e\u3002\u56e0\u6b64&#xff0c;\u7f16\u8bd1\u7cfb\u7edf\u91c7\u7528\u5ef6\u8fdf\u7ed1\u5b9a&#xff0c;\u5c06\u8fc7\u7a0b\u5730\u5740\u7684\u7ed1\u5b9a\u63a8\u8fdf\u5230\u7b2c\u4e00\u6b21\u8c03\u7528\u8be5\u8fc7\u7a0b\u7684\u65f6\u5019\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5ef6\u8fdf\u7ed1\u5b9a\u9700\u8981\u7528\u5230\u4e24\u4e2a\u6570\u636e\u7ed3\u6784&#xff1a;GOT(Global Offset Table&#xff0c;\u5168\u5c40\u504f\u79fb\u8868)\u548cPLT(Procedure Linkage Table&#xff0c;\u8fc7\u7a0b\u94fe\u63a5\u8868)\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">.plt&#xff1a;PLT\u662f\u4e00\u4e2a\u6570\u7ec4&#xff0c;\u5176\u4e2d\u6bcf\u4e2a\u6761\u76ee\u662f16\u5b57\u8282\u4ee3\u7801\u3002PLT[0]\u662f\u4e00\u4e2a\u7279\u6b8a\u6761\u76ee&#xff0c;\u5b83\u8df3\u8f6c\u5230\u52a8\u6001\u94fe\u63a5\u5668\u4e2d\u3002\u6bcf\u4e2a\u88ab\u53ef\u6267\u884c\u7a0b\u5e8f\u8c03\u7528\u7684\u5e93\u51fd\u6570\u90fd\u6709\u5b83\u81ea\u5df1\u7684PLT\u6761\u76ee\u3002\u6bcf\u4e2a\u6761\u76ee\u90fd\u8d1f\u8d23\u8c03\u7528\u4e00\u4e2a\u5177\u4f53\u7684\u51fd\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">.got&#xff1a;GOT\u662f\u4e00\u4e2a\u6570\u7ec4&#xff0c;\u5176\u4e2d\u6bcf\u4e2a\u6761\u76ee\u662f8\u5b57\u8282\u5730\u5740\u3002\u548cPLT\u8054\u5408\u4f7f\u7528\u65f6&#xff0c;GOT[O]\u548cGOT[1]\u5305\u542b\u52a8\u6001\u94fe\u63a5\u5668\u5728\u89e3\u6790\u51fd\u6570\u5730\u5740\u65f6\u4f1a\u4f7f\u7528\u7684\u4fe1\u606f\u3002GOT[2]\u662f\u52a8\u6001\u94fe\u63a5\u5668\u57281d-linux.so\u6a21\u5757\u4e2d\u7684\u5165\u53e3\u70b9\u3002\u5176\u4f59\u7684\u6bcf\u4e2a\u6761\u76ee\u5bf9\u5e94\u4e8e\u4e00\u4e2a\u88ab\u8c03\u7528\u7684\u51fd\u6570&#xff0c;\u5176\u5730\u5740\u9700\u8981\u5728\u8fd0\u884c\u65f6\u88ab\u89e3\u6790\u3002\u6bcf\u4e2a\u6761\u76ee\u90fd\u6709\u4e00\u4e2a\u76f8\u5339\u914d\u7684PLT\u6761\u76ee\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e00\u6b21\u8c03\u7528\u67d0\u4e2a\u51fd\u6570\u65f6&#xff0c;\u7a0b\u5e8f\u4e0d\u662f\u76f4\u63a5\u8c03\u7528&#xff0c;\u800c\u662f\u8c03\u7528\u8fdb\u5165\u51fd\u6570\u6240\u5728\u7684PLT\u6761\u76ee&#xff0c;\u7b2c\u4e00\u6761PLT\u6307\u4ee4\u901a\u8fc7GOT\u8fdb\u884c\u95f4\u63a5\u8df3\u8f6c&#xff0c;\u6bcf\u4e2aGOT\u6761\u76ee\u521d\u59cb\u65f6\u90fd\u6307\u5411\u5176\u5bf9\u5e94\u7684PLT\u6761\u76ee\u7684\u7b2c\u4e8c\u6761\u6307\u4ee4&#xff0c;\u8fd9\u4e2a\u95f4\u63a5\u8df3\u8f6c\u53ea\u662f\u7b80\u5355\u5c06\u63a7\u5236\u4f20\u9001\u56de\u51fd\u6570\u6240\u5728\u7684PLT\u6761\u76ee\u7684\u4e0b\u4e00\u6761\u6307\u4ee4\u3002\u4e4b\u540e\u5c06\u51fd\u6570\u7684ID\u538b\u5165\u6808\u4e2d\u4e4b\u540e&#xff0c;\u51fd\u6570\u6240\u5728\u7684PLT\u6761\u76ee\u8df3\u8f6c\u5230PLT[0]&#xff0c;\u6700\u540ePLT[0]\u901a\u8fc7GOT[1]\u95f4\u63a5\u5730\u628a\u52a8\u6001\u94fe\u63a5\u5668\u7684\u4e00\u4e2a\u53c2\u6570\u538b\u5165\u6808\u4e2d&#xff0c;\u7136\u540e\u901a\u8fc7GOT[2]\u7b80\u4ecb\u8df3\u8f6c\u8fdb\u5165\u52a8\u6001\u94fe\u63a5\u5668\u3002\u52a8\u6001\u94fe\u63a5\u5668\u901a\u8fc7\u4f7f\u7528\u4e24\u4e2a\u6808\u6761\u76ee\u6765\u786e\u5b9a\u51fd\u6570\u7684\u8fd0\u884c\u65f6\u4f4d\u7f6e&#xff0c;\u518d\u5c06\u63a7\u5236\u4f20\u9012\u7ed9\u51fd\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u540e\u7eed\u8c03\u7528\u65f6&#xff0c;\u5219\u53ef\u4ee5\u4e0d\u7528\u901a\u8fc7GOT[4]\u7684\u8df3\u8f6c\u5c06\u63a7\u5236\u7ed9\u5230\u51fd\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello\u5728\u52a8\u6001\u8fde\u63a5\u5668\u52a0\u8f7d\u524d\u540e\u7684\u91cd\u5b9a\u4f4d\u662f\u4e0d\u4e00\u6837\u7684&#xff0c;\u5728\u52a0\u8f7d\u4e4b\u540e\u624d\u8fdb\u884c\u91cd\u5b9a\u4f4d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"301\" src=\"2025-06-10bbyk5pgnbhc.png\" width=\"921\" \/><\/p>\n<h3 style=\"text-align:justify\">5.8 \u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u7ae0\u8282\u7b80\u8981\u4ecb\u7ecd\u4e86\u94fe\u63a5\u7684\u76f8\u5173\u8fc7\u7a0b&#xff0c;\u9996\u5148\u7b80\u8981\u9610\u8ff0\u4e86\u94fe\u63a5\u7684\u6982\u5ff5\u548c\u4f5c\u7528&#xff0c;\u7ed9\u51fa\u4e86\u94fe\u63a5\u5728Ubuntu\u7cfb\u7edf\u4e0b\u7684\u6307\u4ee4\u3002\u4e4b\u540e\u7814\u7a76\u4e86\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6hello\u7684ELF\u683c\u5f0f&#xff0c;\u5e76\u901a\u8fc7edb\u8c03\u8bd5\u5de5\u5177\u67e5\u770b\u4e86\u865a\u62df\u5730\u5740\u7a7a\u95f4\u548c\u51e0\u4e2a\u8282\u7684\u5185\u5bb9&#xff0c;\u4e4b\u540e\u4f9d\u636e\u91cd\u5b9a\u4f4d\u6761\u76ee\u5206\u6790\u4e86\u91cd\u5b9a\u4f4d\u7684\u8fc7\u7a0b&#xff0c;\u5e76\u501f\u52a9edb\u8c03\u8bd5\u5de5\u5177&#xff0c;\u7814\u7a76\u4e86\u7a0b\u5e8f\u4e2d\u5404\u4e2a\u5b50\u7a0b\u5e8f\u7684\u6267\u884c\u6d41\u7a0b&#xff0c;\u6700\u540e\u5219\u501f\u52a9edb\u8c03\u8bd5\u5de5\u5177\u901a\u8fc7\u5bf9\u865a\u62df\u5185\u5b58\u7684\u67e5\u53d6&#xff0c;\u5206\u6790\u7814\u7a76\u4e86\u52a8\u6001\u94fe\u63a5\u7684\u8fc7\u7a0b\u3002\u901a\u8fc7\u94fe\u63a5&#xff0c;hello.o\u4e0e\u5b83\u4f9d\u8d56\u7684\u6240\u6709\u7684\u5e93\u7ed3\u5408\u5728\u4e00\u8d77\u5f62\u6210\u4e86\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u5728\u8fd9\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u4e2d&#xff0c;\u6240\u6709\u7684\u8fd0\u884c\u65f6\u4f4d\u7f6e\u90fd\u5df2\u7ecf\u786e\u5b9a&#xff0c;\u53ef\u4ee5\u88ab\u590d\u5236\u5230\u5185\u5b58\u91cc\u5e76\u8fd0\u884c\u4e86\u3002<\/p>\n<h2 style=\"text-align:center\">\u7b2c6\u7ae0 hello\u8fdb\u7a0b\u7ba1\u7406<\/h2>\n<h3 style=\"text-align:justify\">6.1 \u8fdb\u7a0b\u7684\u6982\u5ff5\u4e0e\u4f5c\u7528<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdb\u7a0b\u7684\u6982\u5ff5&#xff1a;\u8fdb\u7a0b\u662f\u8ba1\u7b97\u673a\u4e2d\u7684\u7a0b\u5e8f\u5173\u4e8e\u67d0\u6570\u636e\u96c6\u5408\u4e0a\u7684\u4e00\u6b21\u8fd0\u884c\u6d3b\u52a8&#xff0c;\u662f\u7cfb\u7edf\u8fdb\u884c\u8d44\u6e90\u5206\u914d\u548c\u8c03\u5ea6\u7684\u57fa\u672c\u5355\u4f4d&#xff0c;\u662f\u64cd\u4f5c\u7cfb\u7edf\u7ed3\u6784\u7684\u57fa\u7840\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdb\u7a0b\u7684\u4f5c\u7528&#xff1a;\u5728\u8fd0\u884c\u4e00\u4e2a\u8fdb\u7a0b\u65f6&#xff0c;\u6211\u4eec\u7684\u8fd9\u4e2a\u7a0b\u5e8f\u770b\u4f3c\u662f\u7cfb\u7edf\u5f53\u4e2d\u552f\u4e00\u4e00\u4e2a\u8fd0\u884c\u7684\u7a0b\u5e8f&#xff0c;\u8fdb\u7a0b\u7684\u4f5c\u7528\u5c31\u662f\u63d0\u4f9b\u7ed9\u7a0b\u5e8f\u4e24\u4e2a\u5173\u952e\u7684\u62bd\u8c61&#xff1a;1.\u72ec\u7acb\u7684\u903b\u8f91\u63a7\u5236\u6d41&#xff0c;\u5373\u7a0b\u5e8f\u72ec\u5360\u4f7f\u7528\u5904\u7406\u5668\u7684\u5047\u8c61\u30022.\u79c1\u6709\u7684\u5730\u5740\u7a7a\u95f4&#xff0c;\u5373\u7a0b\u5e8f\u72ec\u5360\u4f7f\u7528\u5185\u5b58\u7cfb\u7edf\u7684\u5047\u8c61\u3002<\/p>\n<h3 style=\"text-align:justify\">6.2 \u7b80\u8ff0\u58f3Shell-bash\u7684\u4f5c\u7528\u4e0e\u5904\u7406\u6d41\u7a0b<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">Shell\u662f\u4e00\u79cd\u4ea4\u4e92\u578b\u7a0b\u5e8f&#xff0c;\u7528\u4e8e\u4ee3\u8868\u7528\u6237\u8fd0\u884c\u5176\u4ed6\u7a0b\u5e8f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">Shell\u7684\u5904\u7406\u6d41\u7a0b\u5982\u4e0b&#xff1a;\u9996\u5148\u5bf9\u547d\u4ee4\u884c\u53c2\u6570\u6c42\u503c&#xff0c;\u5224\u65ad\u547d\u4ee4\u884c\u662f\u5426\u4e3a\u7a7a&#xff0c;\u5982\u679c\u4e0d\u4e3a\u7a7a\u5219\u5224\u65ad\u7b2c\u4e00\u4e2a\u547d\u4ee4\u884c\u53c2\u6570\u662f\u4e0d\u662f\u4e00\u4e2a\u5185\u7f6e\u7684\u547d\u4ee4&#xff0c;\u5982\u679c\u662f\u4e00\u4e2a\u5185\u7f6e\u547d\u4ee4\u5219\u76f4\u63a5\u6267\u884c&#xff0c;\u5426\u5219\u68c0\u67e5\u662f\u5426\u662f\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002\u4e4b\u540e\u5728\u641c\u7d22\u8def\u5f84\u91cc\u5bfb\u627e\u8fd9\u4e9b\u5e94\u7528\u7a0b\u5e8f&#xff0c;\u5982\u679c\u952e\u5165\u7684\u547d\u4ee4\u4e0d\u662f\u4e00\u4e2a\u5185\u90e8\u547d\u4ee4\u5e76\u4e14\u8def\u5f84\u91cc\u6ca1\u6709\u627e\u5230\u8fd9\u4e2a\u53ef\u6267\u884c\u6587\u4ef6&#xff0c;\u5219\u4f1a\u663e\u793a\u4e00\u6761\u9519\u8bef\u4fe1\u606f\u3002\u5982\u679c\u80fd\u591f\u6210\u529f\u627e\u5230\u547d\u4ee4&#xff0c;\u90a3\u4e48\u8be5\u5185\u90e8\u547d\u4ee4\u6216\u8005\u5e94\u7528\u7a0b\u5e8f\u5c06\u4f1a\u88ab\u5206\u89e3\u4e3a\u7cfb\u7edf\u8c03\u7528\u5e76\u4f20\u9012\u7ed9linux\u5185\u6838\u3002<\/p>\n<h3 style=\"text-align:justify\">6.3 Hello\u7684fork\u8fdb\u7a0b\u521b\u5efa\u8fc7\u7a0b<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">Shell\u8c03\u7528fork\u521b\u5efa\u5b50\u8fdb\u7a0b\u3002\u65b0\u521b\u5efa\u7684\u5b50\u8fdb\u7a0b\u51e0\u4e4e\u4f46\u4e0d\u5b8c\u5168\u4e0e\u7236\u8fdb\u7a0b\u76f8\u540c\u3002\u5b50\u8fdb\u7a0b\u5f97\u5230\u4e0e\u7236\u8fdb\u7a0b\u7528\u6237\u7ea7\u865a\u62df\u5730\u5740\u7a7a\u95f4\u76f8\u540c\u7684&#xff08;\u4f46\u662f\u72ec\u7acb\u7684&#xff09;\u4e00\u4efd\u526f\u672c&#xff0c;\u5305\u62ec\u4ee3\u7801\u548c\u6570\u636e\u6bb5\u3001\u5806\u3001\u5171\u4eab\u5e93\u4ee5\u53ca\u7528\u6237\u6808\u3002\u5b50\u8fdb\u7a0b\u8fd8\u83b7\u5f97\u4e0e\u7236\u8fdb\u7a0b\u4efb\u4f55\u6253\u5f00\u6587\u4ef6\u63cf\u8ff0\u7b26\u76f8\u540c\u7684\u526f\u672c&#xff0c;\u56e0\u6b64fork\u540e\u5b50\u8fdb\u7a0b\u53ef\u4ee5\u8bfb\u5199\u7236\u8fdb\u7a0b\u4e2d\u6253\u5f00\u7684\u4efb\u610f\u6587\u4ef6\u3002\u7236\u8fdb\u7a0b\u548c\u521b\u5efa\u7684\u5b50\u8fdb\u7a0b\u6700\u5927\u7684\u533a\u522b\u5728\u4e8e\u5176PID\u4e0d\u540c\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">fork\u4f1a\u88ab\u7236\u8fdb\u7a0b\u8c03\u7528\u4e00\u6b21&#xff0c;\u8fd4\u56de\u4e24\u6b21&#xff0c;\u7236\u8fdb\u7a0b\u4e0e\u521b\u5efa\u7684\u5b50\u8fdb\u7a0b\u5e76\u53d1\u6267\u884c\u3002\u6267\u884chello\u65f6&#xff0c;fork\u540e\u7684\u8fdb\u7a0b\u5728\u524d\u53f0\u6267\u884c&#xff0c;\u56e0\u6b64\u521b\u5efa\u5b83\u7684\u7236\u8fdb\u7a0bshell\u6682\u65f6\u6302\u8d77\u7b49\u5f85hello\u8fdb\u7a0b\u6267\u884c\u5b8c\u6bd5\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"370\" src=\"2025-06-10xnppikgv4w2.png\" width=\"406\" \/><\/p>\n<h3 style=\"text-align:justify\">6.4 Hello\u7684execve\u8fc7\u7a0b<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">shell\u901a\u8fc7fork\u521b\u5efa\u4e00\u4e2a\u5b50\u8fdb\u7a0b\u540e&#xff0c;execve\u51fd\u6570\u5728\u5f53\u524d\u8fdb\u7a0b\u7684\u4e0a\u4e0b\u6587\u4e2d\u52a0\u8f7d\u5e76\u8fd0\u884c\u4e00\u4e2a\u65b0\u7a0b\u5e8f\u5373hello\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">Execve\u9700\u8981\u4e09\u4e2a\u53c2\u6570&#xff1a;\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u540dfilename\u3001\u53c2\u6570\u5217\u8868argv\u3001\u73af\u5883\u53d8\u91cf\u5217\u8868envp\u3002\u8fd9\u4e9b\u90fd\u7531shell\u6784\u9020\u5e76\u4f20\u9012\u3002\u9664\u975e\u627e\u4e0d\u5230filename&#xff0c;\u5426\u5219execve\u4e0d\u4f1a\u8fd4\u56de\u3002(\u8c03\u7528\u4e00\u6b21&#xff0c;&#xff08;\u6b63\u5e38\u60c5\u51b5\u4e0b&#xff09;\u4ece\u4e0d\u8fd4\u56de)<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8c03\u7528execve\u4f1a\u5c06\u8fd9\u4e2a\u8fdb\u7a0b\u6267\u884c\u7684\u539f\u672c\u7684\u7a0b\u5e8f\u5b8c\u5168\u66ff\u6362&#xff0c;\u5b83\u4f1a\u5220\u9664\u5df2\u5b58\u5728\u7684\u7528\u6237\u533a\u57df&#xff0c;\u5305\u62ec\u6570\u636e\u548c\u4ee3\u7801&#xff1b;\u7136\u540e&#xff0c;\u6620\u5c04\u79c1\u6709\u533a&#xff1a;\u4e3aHello\u7684\u4ee3\u7801\u3001\u6570\u636e\u3001.bss\u548c\u6808\u533a\u57df\u521b\u5efa\u65b0\u7684\u533a\u57df\u7ed3\u6784&#xff0c;\u6240\u6709\u8fd9\u4e9b\u533a\u57df\u90fd\u662f\u79c1\u6709\u7684\u3001\u5199\u65f6\u624d\u590d\u5236\u7684&#xff1b;\u4e4b\u540e\u6620\u5c04\u5171\u4eab\u533a&#xff1b;\u6700\u540e\u628a\u63a7\u5236\u4f20\u9012\u7ed9\u5f53\u524d\u7684\u8fdb\u7a0b\u7684\u7a0b\u5e8f\u5165\u53e3\u3002<\/p>\n<h3 style=\"text-align:justify\">6.5 Hello\u7684\u8fdb\u7a0b\u6267\u884c<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.5.1\u903b\u8f91\u63a7\u5236\u6d41<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u903b\u8f91\u63a7\u5236\u6d41\u662f\u4e00\u4e2aPC\u503c\u7684\u5e8f\u5217&#xff0c;PC\u503c\u5c31\u662f\u7a0b\u5e8f\u8ba1\u6570\u5668\u7684\u503c&#xff0c;\u8fd9\u4e9b\u503c\u4e0e\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6\u7684\u6307\u4ee4\u6216\u8005\u5305\u542b\u5728\u8fd0\u884c\u65f6\u52a8\u6001\u94fe\u63a5\u5230\u7a0b\u5e8f\u7684\u5171\u4eab\u5bf9\u8c61\u4e2d\u7684\u6307\u4ee4\u4e00\u4e00\u5bf9\u5e94\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.5.2\u00a0\u65f6\u95f4\u5206\u7247<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u73b0\u4ee3\u8ba1\u7b97\u673a\u4f53\u7cfb\u4e2d&#xff0c;\u8fdb\u7a0b\u662f\u8f6e\u6d41\u4f7f\u7528\u5904\u7406\u5668\u7684&#xff0c;\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u6267\u884c\u5b83\u7684\u6d41\u7684\u4e00\u90e8\u5206&#xff0c;\u7136\u540e\u88ab\u62a2\u5360&#xff08;\u6682\u65f6\u6302\u8d77&#xff09;&#xff0c;\u518d\u8f6e\u5230\u5176\u5b83\u8fdb\u7a0b\u3002\u4e00\u4e2a\u903b\u8f91\u6d41\u7684\u6267\u884c\u5728\u65f6\u95f4\u4e0a\u4e0e\u53e6\u4e00\u4e2a\u6d41\u91cd\u53e0\u88ab\u79f0\u4e3a\u5e76\u53d1\u6d41&#xff0c;\u8fd9\u4e24\u4e2a\u6d41\u5e76\u53d1\u8fd0\u884c\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u591a\u4e2a\u6d41\u5e76\u53d1\u6267\u884c\u7684\u6982\u5ff5\u88ab\u79f0\u4e3a\u5e76\u53d1\u3002\u4e00\u4e2a\u8fdb\u7a0b\u4e0e\u5176\u4ed6\u8fdb\u7a0b\u8f6e\u6d41\u8fd0\u884c\u7684\u6982\u5ff5\u79f0\u4e3a\u591a\u4efb\u52a1\u3002\u4e00\u4e2a\u8fdb\u7a0b\u6267\u884c\u5176\u63a7\u5236\u6d41\u4e00\u90e8\u5206\u7684\u6bcf\u4e00\u4e2a\u65f6\u95f4\u6bb5\u53eb\u505a\u65f6\u95f4\u7247&#xff0c;\u591a\u4efb\u52a1\u4e5f\u5c31\u88ab\u79f0\u4f5c\u662f\u65f6\u95f4\u5206\u7247\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.5.3\u00a0\u7528\u6237\u6a21\u5f0f\u4e0e\u5185\u6838\u6a21\u5f0f<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e3a\u4e86\u4fdd\u62a4\u64cd\u4f5c\u7cfb\u7edf\u5185\u6838&#xff0c;\u5904\u7406\u5668\u5728\u67d0\u4e00\u4e2a\u63a7\u5236\u5bc4\u5b58\u5668\u4e2d\u7684\u4e00\u4e2a\u6a21\u5f0f\u4f4d&#xff0c;\u8bbe\u7f6e\u6a21\u5f0f\u4f4d\u65f6&#xff0c;\u8fdb\u7a0b\u5c31\u8fd0\u884c\u5728\u5185\u6838\u6a21\u5f0f\u4e2d&#xff0c;\u5426\u5219\u8fd0\u884c\u5728\u7528\u6237\u6a21\u5f0f\u3002\u5185\u6838\u6a21\u5f0f\u7684\u4ee3\u7801\u53ef\u4ee5\u65e0\u9650\u5236\u5730\u8bbf\u95ee\u6240\u6709\u5904\u7406\u5668\u6307\u4ee4\u96c6\u4ee5\u53ca\u5168\u90e8\u5185\u5b58\u548c I\/O \u7a7a\u95f4\u3002\u5982\u679c\u7528\u6237\u6a21\u5f0f\u7684\u8fdb\u7a0b\u8981\u4eab\u6709\u6b64\u7279\u6743,\u5b83\u5fc5\u987b\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\u5411\u8bbe\u5907\u9a71\u52a8\u7a0b\u5e8f\u6216\u5176\u4ed6\u5185\u6838\u6a21\u5f0f\u7684\u4ee3\u7801\u53d1\u51fa\u8bf7\u6c42\u3002\u53e6\u5916,\u7528\u6237\u6a21\u5f0f\u7684\u4ee3\u7801\u5141\u8bb8\u53d1\u751f\u7f3a\u9875,\u800c\u5185\u6838\u6a21\u5f0f\u7684\u4ee3\u7801\u5219\u4e0d\u5141\u8bb8\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd0\u884c\u7a0b\u5e8f\u4ee3\u7801\u521d\u59cb\u65f6\u90fd\u662f\u5728\u7528\u6237\u6a21\u5f0f\u4e2d\u7684&#xff0c;\u5f53\u53d1\u751f\u4e2d\u65ad\u6545\u969c\u6216\u7cfb\u7edf\u8c03\u7528\u7684\u5f02\u5e38\u65f6&#xff0c;\u8fdb\u7a0b\u4ece\u7528\u6237\u6a21\u5f0f\u8f6c\u53d8\u4e3a\u5185\u6838\u6a21\u5f0f\u3002\u5f53\u5f02\u5e38\u53d1\u751f\u65f6&#xff0c;\u63a7\u5236\u4f20\u9012\u5230\u5f02\u5e38\u5904\u7406\u7a0b\u5e8f&#xff0c;\u5904\u7406\u5668\u5c06\u6a21\u5f0f\u8f6c\u53d8\u4e3a\u5185\u6838\u6a21\u5f0f\u3002\u5185\u6838\u5904\u7406\u7a0b\u5e8f\u8fd0\u884c\u5728\u5185\u6838\u6a21\u5f0f\u4e2d&#xff0c;\u5f53\u5b83\u8fd4\u56de\u5230\u5e94\u7528\u7a0b\u5e8f\u4ee3\u7801\u65f6&#xff0c;\u5904\u7406\u5668\u628a\u6a21\u5f0f\u4ece\u5185\u6838\u6a21\u5f0f\u6539\u56de\u5230\u7528\u6237\u6a21\u5f0f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.5.4 \u8fdb\u7a0b\u4e0a\u4e0b\u6587\u5207\u6362<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4e0a\u4e0b\u6587\u5c31\u662f\u5185\u6838\u91cd\u65b0\u542f\u52a8\u4e00\u4e2a\u88ab\u62a2\u5360\u7684\u8fdb\u7a0b\u6240\u9700\u8981\u7684\u72b6\u6001&#xff0c;\u5b83\u7531\u901a\u7528\u76ee\u7684\u5bc4\u5b58\u5668\u3001\u6d6e\u70b9\u5bc4\u5b58\u5668\u3001\u7a0b\u5e8f\u8ba1\u6570\u5668\u3001\u7528\u6237\u6808\u3001\u72b6\u6001\u5bc4\u5b58\u5668\u3001\u5185\u6838\u6808\u548c\u5404\u79cd\u5185\u6838\u6570\u636e\u7ed3\u6784\u7b49\u5bf9\u8c61\u7684\u503c\u6784\u6210\u3002\u8fdb\u7a0b\u6267\u884c\u7684\u67d0\u4e9b\u65f6\u523b&#xff0c;\u5185\u6838\u53ef\u4ee5\u51b3\u5b9a\u62a2\u5360\u5f53\u524d\u8fdb\u7a0b&#xff0c;\u5e76\u91cd\u65b0\u5f00\u59cb\u4e00\u4e2a\u5148\u524d\u88ab\u62a2\u5360\u4e86\u7684\u8fdb\u7a0b&#xff0c;\u8fd9\u6837\u7684\u51b3\u7b56\u53eb\u505a\u8c03\u5ea6&#xff0c;\u7531\u5185\u6838\u4e2d\u7684\u8c03\u5ea6\u5668\u7684\u4ee3\u7801\u5904\u7406\u3002\u5728\u8fd9\u4e2a\u62a2\u5360\u8fc7\u7a0b\u4e2d\u9700\u8981\u7528\u5230\u4e0a\u4e0b\u6587\u5207\u6362&#xff0c;\u4e0a\u4e0b\u6587\u5207\u6362\u4fdd\u5b58\u5f53\u524d\u8fdb\u7a0b\u7684\u4e0a\u4e0b\u6587&#xff0c;\u6062\u590d\u5148\u524d\u67d0\u4e2a\u88ab\u62a2\u5360\u7684\u4e0a\u4e0b\u6587&#xff0c;\u5e76\u5c06\u63a7\u5236\u4f20\u9012\u7ed9\u65b0\u6062\u590d\u7684\u8fdb\u7a0b\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"484\" src=\"2025-06-10mqwivid5f3g.png\" width=\"778\" \/><\/p>\n<h3 style=\"text-align:justify\">6.6 hello\u7684\u5f02\u5e38\u4e0e\u4fe1\u53f7\u5904\u7406<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.6.1\u5f02\u5e38\u7c7b\u578b<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd0\u884c\u65f6\u5f02\u5e38&#xff1a;\u5982\u9664\u4ee5\u96f6\u3001\u7a7a\u6307\u9488\u5f15\u7528\u7b49&#xff0c;\u8fd9\u7c7b\u5f02\u5e38\u4f1a\u5bfc\u81f4\u7a0b\u5e8f\u5d29\u6e83\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8d44\u6e90\u5f02\u5e38&#xff1a;\u5982\u6587\u4ef6\u672a\u627e\u5230\u3001\u5185\u5b58\u4e0d\u8db3\u7b49&#xff0c;\u8fd9\u7c7b\u5f02\u5e38\u901a\u5e38\u9700\u8981\u7a0b\u5e8f\u8fdb\u884c\u9002\u5f53\u7684\u9519\u8bef\u5904\u7406\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8f93\u5165\u5f02\u5e38&#xff1a;\u7528\u6237\u8f93\u5165\u4e86\u4e0d\u7b26\u5408\u7a0b\u5e8f\u8981\u6c42\u7684\u6570\u636e\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.6.2. \u4ea7\u751f\u7684\u4fe1\u53f7<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">SIGINT&#xff1a;\u5f53\u7528\u6237\u6309\u4e0bCtrl&#043;C\u65f6\u53d1\u9001&#xff0c;\u901a\u5e38\u7528\u4e8e\u4e2d\u65ad\u7a0b\u5e8f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">SIGTSTP&#xff1a;\u5f53\u7528\u6237\u6309\u4e0bCtrl&#043;Z\u65f6\u53d1\u9001&#xff0c;\u7528\u4e8e\u6682\u505c\u7a0b\u5e8f\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">SIGTERM&#xff1a;\u8bf7\u6c42\u7a0b\u5e8f\u7ec8\u6b62\u7684\u6b63\u5e38\u4fe1\u53f7\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">6.6.3\u5177\u4f53\u4fe1\u53f7\u5904\u7406\u4e0e\u547d\u4ee4<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">1.\u4e71\u6309\u5b57<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"543\" src=\"2025-06-10voxcgkj1m42.png\" width=\"874\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u53ef\u4ee5\u770b\u5230&#xff0c;\u5728\u952e\u76d8\u4e2d\u4e71\u6253\u5b57\u5e76\u6ca1\u6709\u6539\u53d8printf\u7684\u8f93\u51fa&#xff0c;\u4e0d\u5f71\u54cd\u7a0b\u5e8f\u7684\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0\u00a0\u00a02.\u6309Ctrl&#043;Z<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"322\" src=\"2025-06-105xhesvkfcie.png\" width=\"843\" \/><\/p>\n<p>Ctrl&#043;Z\u7684\u529f\u80fd\u662f\u5411\u8fdb\u7a0b\u53d1\u9001SIGSTP\u4fe1\u53f7&#xff0c;\u8fdb\u7a0b\u63a5\u6536\u5230\u8be5\u4fe1\u53f7\u4e4b\u540e\u4f1a\u5c06\u8be5\u4f5c\u4e1a\u6302\u8d77&#xff0c;\u4f46\u4e0d\u4f1a\u56de\u6536\u3002\u4e0b\u56fe\u663e\u793a\u4e86&#xff0c;PID\u4e3a4826\u7684hello\u8fdb\u7a0b\u4ecd\u7136\u5728\u8fd0\u884c\u4e2d\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"385\" src=\"2025-06-10vobts3whs13.png\" width=\"853\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd0\u884cjobs\u6307\u4ee4&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5f97\u77e5hello\u7684\u540e\u53f0job id&#061;1\u3002<\/p>\n<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"106\" src=\"2025-06-10hhwpsdwcrbd.png\" width=\"638\" \/><\/p>\n<p>\u6211\u4eec\u518d\u8c03\u7528fg\u547d\u4ee4\u3002fg\u547d\u4ee4\u7528\u4e8e\u5c06\u540e\u53f0\u4f5c\u4e1a&#xff08;\u5728\u540e\u53f0\u8fd0\u884c\u7684\u6216\u8005\u5728\u540e\u53f0\u6302\u8d77\u7684\u4f5c\u4e1a&#xff09;\u653e\u5230\u524d\u53f0\u7ec8\u7aef\u8fd0\u884c\u3002\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\u3002\u6211\u4eec\u53d1\u73b0&#xff0c;\u6302\u8d77\u524d\u540e\u603b\u5171\u7684\u8f93\u51fa\u6b21\u6570\u4ecd\u4e3a10\u6b21\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"606\" src=\"2025-06-10yvjxzu0oa3z.png\" width=\"832\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.Ctrl-C<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u4e0a\u4e00\u6b65\u4e4b\u540e&#xff0c;\u6211\u4eec\u5728\u952e\u76d8\u4e2d\u8f93\u5165Ctrl&#043;C,Ctrl-C\u547d\u4ee4\u5185\u6838\u5411\u524d\u53f0\u53d1\u9001SIGINT\u4fe1\u53f7&#xff0c;\u7ec8\u6b62\u4e86\u524d\u53f0\u4f5c\u4e1a\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"381\" src=\"2025-06-10x25o243h5er.png\" width=\"672\" \/><\/p>\n<p>4.\u4e0d\u505c\u6309\u56de\u8f66<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"709\" src=\"2025-06-10poq4v1ekhwg.png\" width=\"664\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u6211\u4eec\u53d1\u73b0&#xff0c;\u5728hello\u6267\u884c\u8fc7\u7a0b\u4e2d\u4e0d\u505c\u6309\u56de\u8f66&#xff0c;\u4e0d\u4ec5\u5728printf\u8f93\u51fa\u65f6\u4f1a\u663e\u793a\u51fa\u56de\u8f66&#xff0c;\u5728hello\u8fdb\u7a0b\u6267\u884c\u5b8c\u6bd5\u540e&#xff0c;\u6211\u4eec\u53ef\u4ee5\u770b\u51fa\u56de\u8f66\u7684\u4fe1\u606f\u4e5f\u540c\u6837\u53d1\u9001\u5230\u4e86shell\u4e2d&#xff0c;\u4f7fshell\u8fdb\u884c\u4e86\u82e5\u5e72\u6b21\u7684\u5237\u65b0\u6362\u884c\u3002<\/p>\n<h3 style=\"text-align:justify\">6.7\u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672c\u7ae0\u6982\u8ff0\u4e86hello\u8fdb\u7a0b\u5927\u81f4\u7684\u6267\u884c\u8fc7\u7a0b&#xff0c;\u9610\u8ff0\u4e86\u8fdb\u7a0b\u3001shell\u3001fork\u3001execve\u7b49\u76f8\u5173\u6982\u5ff5&#xff0c;\u4e4b\u540e\u4ece\u903b\u8f91\u63a7\u5236\u6d41\u3001\u65f6\u95f4\u5206\u7247\u3001\u7528\u6237\u6a21\u5f0f\/\u5185\u6838\u6a21\u5f0f\u3001\u4e0a\u4e0b\u6587\u5207\u6362\u7b49\u89d2\u5ea6\u8be6\u7ec6\u5206\u6790\u4e86\u8fdb\u7a0b\u7684\u6267\u884c\u8fc7\u7a0b\u3002\u5e76\u5728\u8fd0\u884c\u65f6\u5c1d\u8bd5\u4e86\u4e0d\u540c\u5f62\u5f0f\u7684\u547d\u4ee4\u548c\u5f02\u5e38&#xff0c;\u6bcf\u79cd\u4fe1\u53f7\u90fd\u6709\u4e0d\u540c\u5904\u7406\u673a\u5236&#xff0c;\u9488\u5bf9\u4e0d\u540c\u7684shell\u547d\u4ee4&#xff0c;hello\u4f1a\u4ea7\u751f\u4e0d\u540c\u54cd\u5e94\u3002<\/p>\n<\/p>\n<h2 style=\"text-align:center\">\u7b2c7\u7ae0 hello\u7684\u5b58\u50a8\u7ba1\u7406<\/h2>\n<h3 style=\"text-align:justify\">7.1 hello\u7684\u5b58\u50a8\u5668\u5730\u5740\u7a7a\u95f4<\/h3>\n<p style=\"margin-left:0pt;text-align:justify\">\u7269\u7406\u5730\u5740&#xff1a;CPU\u901a\u8fc7\u5730\u5740\u603b\u7ebf\u7684\u5bfb\u5740&#xff0c;\u627e\u5230\u771f\u5b9e\u7684\u7269\u7406\u5185\u5b58\u5bf9\u5e94\u5730\u5740\u3002CPU\u5bf9\u5185\u5b58\u7684\u8bbf\u95ee\u662f\u901a\u8fc7\u8fde\u63a5\u7740CPU\u548c\u5317\u6865\u82af\u7247\u7684\u524d\u7aef\u603b\u7ebf\u6765\u5b8c\u6210\u7684\u3002\u5728\u524d\u7aef\u603b\u7ebf\u4e0a\u4f20\u8f93\u7684\u5185\u5b58\u5730\u5740\u90fd\u662f\u7269\u7406\u5185\u5b58\u5730\u5740\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u903b\u8f91\u5730\u5740&#xff1a;\u7a0b\u5e8f\u4ee3\u7801\u7ecf\u8fc7\u7f16\u8bd1\u540e\u51fa\u73b0\u5728\u6c47\u7f16\u7a0b\u5e8f\u4e2d\u5730\u5740\u3002\u903b\u8f91\u5730\u5740\u7531\u9009\u62e9\u7b26&#xff08;\u5728\u5b9e\u6a21\u5f0f\u4e0b\u662f\u63cf\u8ff0\u7b26&#xff0c;\u5728\u4fdd\u62a4\u6a21\u5f0f\u4e0b\u662f\u7528\u6765\u9009\u62e9\u63cf\u8ff0\u7b26\u7684\u9009\u62e9\u7b26&#xff09;\u548c\u504f\u79fb\u91cf&#xff08;\u504f\u79fb\u90e8\u5206&#xff09;\u7ec4\u6210\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u7ebf\u6027\u5730\u5740&#xff1a;\u7ebf\u6027\u5730\u5740\u7a7a\u95f4\u662f\u4e00\u4e2a\u975e\u8d1f\u6574\u6570\u7684\u96c6\u5408\u3002\u903b\u8f91\u5730\u5740\u7ecf\u8fc7\u6bb5\u673a\u5236\u540e\u8f6c\u5316\u4e3a\u7ebf\u6027\u5730\u5740&#xff0c;\u4e3a\u63cf\u8ff0\u7b26:\u504f\u79fb\u91cf\u7684\u7ec4\u5408\u5f62\u5f0f\u3002\u5728\u8c03\u8bd5hello\u65f6&#xff0c;gdb\u4e2d\u67e5\u770b\u5230\u7684\u5c31\u662f\u7ebf\u6027\u5730\u5740&#xff0c;\u6216\u8005\u865a\u62df\u5730\u5740\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u865a\u62df\u5730\u5740&#xff1a;\u865a\u62df\u5730\u5740\u7a7a\u95f4\u662f0\u5230N\u7684\u6240\u6709\u6574\u6570\u7684\u96c6\u5408&#xff08;N\u662f\u6b63\u6574\u6570&#xff09;&#xff0c;\u662f\u7ebf\u6027\u5730\u5740\u7a7a\u95f4\u7684\u6709\u9650\u5b50\u96c6\u3002\u5206\u9875\u673a\u5236\u4ee5\u865a\u62df\u5730\u5740\u4e3a\u6865\u6881&#xff0c;\u5c06\u786c\u76d8\u548c\u7269\u7406\u5185\u5b58\u8054\u7cfb\u8d77\u6765\u3002<\/p>\n<h3 style=\"text-align:justify\">7.2 Intel\u903b\u8f91\u5730\u5740\u5230\u7ebf\u6027\u5730\u5740\u7684\u53d8\u6362-\u6bb5\u5f0f\u7ba1\u7406<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728 Intel \u5e73\u53f0\u4e0b&#xff0c;\u903b\u8f91\u5730\u5740\u662f selector:offset \u8fd9\u79cd\u5f62\u5f0f&#xff0c;selector \u662f CS \u5bc4\u5b58\u5668\u7684\u503c&#xff0c;offset \u662f EIP \u5bc4\u5b58\u5668\u7684\u503c\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">CS\u5bc4\u5b58\u5668&#xff08;\u4ee3\u7801\u6bb5\u5bc4\u5b58\u5668&#xff09;&#xff1a; CS\u5bc4\u5b58\u5668\u5b58\u50a8\u4e86\u5f53\u524d\u6267\u884c\u7684\u6307\u4ee4\u6240\u5728\u7684\u4ee3\u7801\u6bb5\u7684\u8d77\u59cb\u5730\u5740\u3002\u5b83\u662f\u4e00\u4e2a16\u4f4d\u5bc4\u5b58\u5668&#xff0c;\u6307\u793a\u4e86\u4ee3\u7801\u5728\u5185\u5b58\u4e2d\u7684\u4f4d\u7f6e\u3002CS\u5bc4\u5b58\u5668\u7684\u503c\u4e0e\u4ee3\u7801\u6bb5\u7684\u6bb5\u57fa\u5740\u76f8\u5173&#xff0c;\u5f62\u6210\u4e86\u4ee3\u7801\u6bb5\u7684\u8d77\u59cb\u7269\u7406\u5730\u5740\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">EIP\u5bc4\u5b58\u5668&#xff1a;\u7528\u6765\u5b58\u50a8CPU\u8981\u8bfb\u53d6\u6307\u4ee4\u7684\u5730\u5740&#xff0c;CPU\u901a\u8fc7EIP\u5bc4\u5b58\u5668\u8bfb\u53d6\u5373\u5c06\u8981\u6267\u884c\u7684\u6307\u4ee4\u3002\u6bcf\u6b21CPU\u6267\u884c\u5b8c\u76f8\u5e94\u7684\u6c47\u7f16\u6307\u4ee4\u4e4b\u540e&#xff0c;EIP\u5bc4\u5b58\u5668\u7684\u503c\u5c31\u4f1a\u589e\u52a0\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5982\u679c\u7528 selector \u53bb GDT( Global\u00a0Descriptor Table&#xff0c;\u5168\u5c40\u63cf\u8ff0\u7b26\u8868 ) \u91cc\u62ff\u5230 segment base address(\u6bb5\u57fa\u5740) \u7136\u540e\u52a0\u4e0a offset(\u6bb5\u5185\u504f\u79fb)&#xff0c;\u8fd9\u5c31\u5f97\u5230\u4e86 linear address&#xff08;\u7ebf\u6027\u5730\u5740&#xff09;\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u79f0\u4f5c\u6bb5\u5f0f\u5185\u5b58\u7ba1\u7406\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u903b\u8f91\u5730\u5740\u7531\u6bb5\u6807\u8bc6\u7b26\u548c\u6bb5\u5185\u504f\u79fb\u91cf\u7ec4\u6210\u3002\u6bb5\u6807\u8bc6\u7b26\u662f\u4e00\u4e2a16\u4f4d\u957f\u7684\u5b57\u6bb5&#xff08;\u6bb5\u9009\u62e9\u7b26&#xff09;&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u6bb5\u6807\u8bc6\u7b26\u7684\u524d13\u4f4d&#xff0c;\u76f4\u63a5\u5728\u6bb5\u63cf\u8ff0\u7b26\u8868\u4e2d\u627e\u5230\u4e00\u4e2a\u5177\u4f53\u7684\u6bb5\u63cf\u8ff0\u7b26&#xff0c;\u8fd9\u4e2a\u63cf\u8ff0\u7b26\u5c31\u63cf\u8ff0\u4e86\u4e00\u4e2a\u6bb5\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5168\u5c40\u7684\u6bb5\u63cf\u8ff0\u7b26&#xff0c;\u653e\u5728GDT\u4e2d&#xff0c;\u4e00\u4e9b\u5c40\u90e8\u7684\u6bb5\u63cf\u8ff0\u7b26&#xff0c;\u653e\u5728\u201cLDT(Local Descriptor Table,\u5c40\u90e8\u6bb5\u63cf\u8ff0\u7b26\u8868)\u201d\u4e2d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7ed9\u5b9a\u4e00\u4e2a\u5b8c\u6574\u7684\u903b\u8f91\u5730\u5740\u6bb5\u9009\u62e9\u7b26&#043;\u6bb5\u5185\u504f\u79fb\u5730\u5740&#xff0c;\u770b\u6bb5\u9009\u62e9\u7b26\u7684T1&#061;0\u8fd8\u662f1&#xff0c;\u77e5\u9053\u5f53\u524d\u8981\u8f6c\u6362\u662fGDT\u4e2d\u7684\u6bb5&#xff0c;\u8fd8\u662fLDT\u4e2d\u7684\u6bb5&#xff0c;\u518d\u6839\u636e\u76f8\u5e94\u5bc4\u5b58\u5668&#xff0c;\u5f97\u5230\u5176\u5730\u5740\u548c\u5927\u5c0f\u3002\u62ff\u51fa\u6bb5\u9009\u62e9\u7b26\u4e2d\u524d13\u4f4d&#xff0c;\u53ef\u4ee5\u5728\u8fd9\u4e2a\u6570\u7ec4\u4e2d&#xff0c;\u67e5\u627e\u5230\u5bf9\u5e94\u7684\u6bb5\u63cf\u8ff0\u7b26&#xff0c;\u5c31\u5f97\u5230\u4e86\u5176\u57fa\u5730\u5740\u3002\u518d\u7531\u57fa\u5730\u5740\u52a0\u4e0a\u504f\u79fb\u91cf\u7684\u503c&#xff0c;\u4fbf\u5f97\u5230\u4e86\u7ebf\u6027\u5730\u5740\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"624\" src=\"2025-06-100t3ii3wkduv.png\" width=\"846\" \/><\/p>\n<h3 style=\"text-align:justify\">7.3 Hello\u7684\u7ebf\u6027\u5730\u5740\u5230\u7269\u7406\u5730\u5740\u7684\u53d8\u6362-\u9875\u5f0f\u7ba1\u7406<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7ebf\u6027\u5730\u5740&#xff08;VA&#xff09;\u5230\u7269\u7406\u5730\u5740&#xff08;PA&#xff09;\u4e4b\u95f4\u7684\u8f6c\u6362\u901a\u8fc7\u5206\u9875\u673a\u5236\u5b8c\u6210\u3002\u5206\u9875\u673a\u5236\u7c7b\u4f3c\u4e3b\u5b58\u548cCache\u4e4b\u95f4\u7684\u5206\u5757\u673a\u5236&#xff0c;\u5206\u9875\u673a\u5236\u5bf9\u865a\u62df\u5730\u5740\u548c\u7269\u7406\u5185\u5b58\u8fdb\u884c\u5206\u9875&#xff0c;\u9875\u7684\u5927\u5c0f\u901a\u5e38\u662f4KB\u52302M&#xff08;\u56e0\u65f6\u800c\u5f02&#xff0c;\u65f6\u8fc7\u5883\u8fc1&#xff0c;\u9875\u7684\u5927\u5c0f\u6709\u6240\u4e0d\u540c&#xff09;\u3002\u5728x86-64\u673a\u5668\u4e0a&#xff0c;\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684N\u662f2\u768448\u6b21\u65b9&#xff0c;\u6709256TB&#xff0c;\u6bd4\u6b63\u5e38\u7684\u786c\u76d8\u5927\u5f97\u591a\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5728\u5206\u9875\u673a\u5236\u4e2d&#xff0c;\u786c\u76d8\u7a7a\u95f4\u7684\u6bcf\u4e2a\u5b57\u8282\u5230\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u6bcf\u4e2a\u5b57\u8282\u5b58\u5728\u6620\u5c04\u5173\u7cfb&#xff0c;\u4e14\u8fd9\u4e2a\u6620\u5c04\u662f\u5355\u5c04\u3002\u865a\u62df\u5730\u5740\u7a7a\u95f4\u548c\u786c\u76d8\u7a7a\u95f4\u90fd\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d&#xff0c;\u4ece0\u5f00\u59cb\u7f16\u5730\u5740\u53f7\u3002\u8bbe\u786c\u76d8\u7a7a\u95f4\u4e3aH&#xff0c;\u865a\u62df\u5730\u5740\u7a7a\u95f4\u4e3aV&#xff0c;\u8bbe\u4ed6\u4eec\u4e4b\u95f4\u7684\u6620\u5c04\u5173\u7cfb\u4e3a<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"21\" src=\"2025-06-10acqncmjt240.png\" width=\"55\" \/>&#xff0c;f\u662f\u5355\u5c04&#xff0c;\u5219<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"29\" src=\"2025-06-10bnqbimuinr0.png\" width=\"288\" \/>\u4e8e\u662f,\u6211\u4eec\u77e5\u9053\u4e86\u7269\u7406\u5730\u5740\u4e2d\u67d0\u4e2a\u5730\u5740\u6240\u5728\u9875\u4e0e\u865a\u62df\u7a7a\u95f4\u7684\u9875\u7684\u5bf9\u5e94\u5173\u7cfb&#xff0c;\u4e5f\u5c31\u77e5\u9053\u4e86\u7269\u7406\u5730\u5740\u4e2d\u67d0\u4e2a\u5730\u5740\u6240\u5728\u9875\u4e0e\u786c\u76d8\u4e2d\u67d0\u4e2a\u9875\u7684\u5bf9\u5e94\u5173\u7cfb\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7269\u7406\u5730\u5740\u4e2d\u67d0\u4e2a\u5730\u5740\u6240\u5728\u9875\u4e0e\u865a\u62df\u7a7a\u95f4\u7684\u9875\u7684\u5bf9\u5e94\u5173\u7cfb\u8981\u901a\u8fc7\u4ec0\u4e48\u6765\u8bb0\u5f55\u5462&#xff1f;\u5206\u9875\u673a\u5236\u4e2d\u4f7f\u7528\u4e00\u4e2a\u53eb\u505a\u9875\u8868\u7684\u6570\u636e\u7ed3\u6784\u6765\u8bb0\u5f55\u8fd9\u4e9b\u5173\u7cfb&#xff0c;\u9875\u8868\u4e5f\u662f\u5b58\u50a8\u5728\u5185\u5b58\u4e2d\u7684&#xff0c;\u662f\u7531\u64cd\u4f5c\u7cfb\u7edf\u7ef4\u62a4\u7684\u3002\u5176\u5b9eDRAM\u5230Cache\u4e2d\u4e5f\u662f\u7c7b\u4f3c\u673a\u5236&#xff0c;\u53ea\u4e0d\u8fc7DRAM\u5230Cache\u7684\u9ad8\u901f\u7f13\u5b58\u673a\u5236\u662f\u7528\u786c\u4ef6\u5b9e\u73b0\u7684\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u6709\u4e00\u4e2a\u9875\u8868&#xff0c;\u9875\u8868\u4e2d\u7684\u6bcf\u4e00\u9879&#xff0c;\u5373PTE(\u9875\u8868\u6761\u76ee)&#xff0c;\u8bb0\u5f55\u7740\u8be5\u5bf9\u5e94\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u90a3\u4e00\u9875\u662f\u5426\u6709\u6548&#xff08;\u5373\u662f\u5426\u6709\u5bf9\u5e94\u7684\u7269\u7406\u5185\u5b58\u4e0a\u7684\u9875&#xff09;&#xff0c;\u7269\u7406\u9875\u7684\u8d77\u59cb\u4f4d\u7f6e\u6216\u78c1\u76d8\u5730\u5740&#xff0c;\u8bbf\u95ee\u6743\u9650\u7b49\u4fe1\u606f\u3002PTE\u6839\u636e\u4e0d\u540c\u7684\u6620\u5c04\u72b6\u6001\u4e5f\u88ab\u5212\u5206\u4e3a\u4e09\u79cd\u72b6\u6001&#xff1a;\u672a\u5206\u914d\u3001\u672a\u7f13\u5b58\u3001\u5df2\u7f13\u5b58\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672a\u5206\u914d&#xff1a;\u865a\u62df\u5185\u5b58\u4e2d\u672a\u5206\u914d\u7684\u9875<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u672a\u7f13\u5b58&#xff1a;\u5df2\u7ecf\u5206\u914d\u4f46\u662f\u8fd8\u6ca1\u6709\u88ab\u7f13\u5b58\u5230\u7269\u7406\u5185\u5b58\u4e2d\u7684\u9875<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5df2\u7f13\u5b58&#xff1a;\u5206\u914d\u540e\u7f13\u5b58\u5230\u7269\u7406\u9875\u5757\u4e2d\u7684\u9875<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"332\" src=\"2025-06-101xgcdchz4ug.png\" width=\"492\" \/><\/p>\n<h3 style=\"text-align:justify\">7.4 TLB\u4e0e\u56db\u7ea7\u9875\u8868\u652f\u6301\u4e0b\u7684VA\u5230PA\u7684\u53d8\u6362<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9875\u8868\u662f PTE&#xff08;\u9875\u8868\u6761\u76ee&#xff09;\u7684\u6570\u7ec4&#xff0c;\u5b83\u5c06\u865a\u62df\u9875\u6620\u5c04\u5230\u7269\u7406\u9875&#xff0c;\u6bcf\u4e2a PTE \u90fd\u6709\u4e00\u4e2a\u6709\u6548\u4f4d\u548c\u4e00\u4e2a n \u4f4d\u5730\u5740\u5b57\u6bb5&#xff0c;\u6709\u6548\u4f4d\u8868\u660e\u8be5\u865a\u62df\u9875\u662f\u5426\u88ab\u7f13\u5b58\u5728 DRAM \u4e2d\u3002\u865a\u62df\u5730\u5740\u5206\u4e3a\u4e24\u4e2a\u90e8\u5206&#xff0c;\u865a\u62df\u9875\u53f7&#xff08;VPN,Virtual Page Number&#xff09;\u548c\u865a\u62df\u9875\u9762\u504f\u79fb\u91cf&#xff08;VPO,Virtual Page Offset&#xff09;\u3002\u5176\u4e2dVPN\u9700\u8981\u5728PTE\u4e2d\u67e5\u8be2\u5bf9\u5e94&#xff0c;\u800cVPO\u5219\u76f4\u63a5\u5bf9\u5e94\u7269\u7406\u5730\u5740\u504f\u79fb&#xff08;PPO&#xff09;\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">TLB&#xff08;translation lookaside buffer&#xff0c;\u5730\u5740\u8f6c\u6362\u540e\u5907\u7f13\u51b2\u5668&#xff0c;\u4e60\u60ef\u79f0\u4e4b\u4e3a\u201c\u5feb\u8868\u201d&#xff09;\u662f\u4e00\u4e2a\u4f4d\u4e8eMMU&#xff08;Memory Management Unit&#xff0c;\u5185\u5b58\u7ba1\u7406\u5355\u5143&#xff09;\u4e2d&#xff0c;\u5173\u4e8ePTE\u7684\u4e00\u4e2a\u7f13\u5b58\u3002TLB\u662f\u4e00\u4e2a\u5c0f\u7684\u3001\u865a\u62df\u5bfb\u5740\u7684\u7f13\u5b58&#xff0c;\u5176\u4e2d\u6bcf\u4e00\u884c\u5747\u4fdd\u5b58\u4e86\u4e00\u4e2a\u7531\u5355\u4e2aPTE\u7ec4\u6210\u7684\u5757\u3002TLB\u6709\u9ad8\u5ea6\u7684\u76f8\u8054\u6027&#xff0c;\u80fd\u591f\u52a0\u901f\u5730\u5740\u7ffb\u8bd1&#xff0c;\u800c\u591a\u7ea7\u9875\u8868\u80fd\u591f\u5bf9\u9875\u8868\u8fdb\u884c\u538b\u7f29&#xff0c;\u4fbf\u4e8e\u5927\u91cf\u5b58\u50a8\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\">\u5728\u4eceVA\u7ffb\u8bd1\u5f97\u5230PA\u7684\u8fc7\u7a0b\u4e2d&#xff0c;MMU\u9996\u5148\u7528VPN\u5411TLB\u7533\u8bf7\u8bf7\u6c42\u5bf9\u5e94\u7684PTE&#xff0c;\u5982\u679c\u547d\u4e2d&#xff0c;\u90a3\u4e48\u76f4\u63a5\u8df3\u8fc7\u540e\u9762\u7684\u6b65\u9aa4&#xff1b;\u4e4b\u540eMMU\u751f\u6210PTE\u5730\u5740&#xff0c;\u4ece\u9ad8\u901f\u4e3b\u5b58\u8bf7\u6c42\u5f97\u5230PTE&#xff0c;\u9ad8\u901f\u7f13\u5b58\u6216\u4e3b\u5b58\u4f1a\u5411MMU\u8fd4\u56dePTE\u3002\u82e5PTE\u6709\u6548\u4f4d\u4e3a0&#xff0c;\u8bf4\u660e\u7f3a\u9875&#xff0c;MMU\u89e6\u53d1\u7f3a\u9875\u5f02\u5e38&#xff0c;\u7f3a\u9875\u5904\u7406\u7a0b\u5e8f\u786e\u5b9a\u7269\u7406\u5185\u5b58\u4e2d\u7684\u727a\u7272\u9875&#xff08;\u82e5\u9875\u9762\u4fee\u6539&#xff0c;\u5219\u6362\u51fa\u5230\u78c1\u76d8&#xff09;\u3002\u4e4b\u540e\u7f3a\u9875\u5904\u7406\u7a0b\u5e8f\u8c03\u5165\u65b0\u7684\u9875\u9762&#xff0c;\u5e76\u66f4\u65b0PTE\u3002\u4e4b\u540e\u5374\u4e5f\u5904\u7406\u7a0b\u5e8f\u8fd4\u56de\u539f\u8fdb\u7a0b&#xff0c;\u5e76\u91cd\u65b0\u6267\u884c\u5bfc\u81f4\u7f3a\u9875\u7684\u6307\u4ee4\u3002<\/p>\n<p style=\"margin-left:0pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"421\" src=\"2025-06-10w0y3zoop3ic.png\" width=\"793\" \/><\/p>\n<p>\u00a0\u56db\u7ea7\u9875\u8868\u662f\u4e00\u79cd\u591a\u7ea7\u9875\u8868&#xff0c;\u591a\u7ea7\u9875\u8868\u7684\u4e3b\u8981\u76ee\u7684\u662f\u7528\u4e8e\u538b\u7f29\u9875\u8868\u3002\u5728\u5730\u5740\u7ffb\u8bd1\u8fc7\u7a0b\u4e2d&#xff0c;\u865a\u62df\u7684\u5730\u5740\u9875\u53f7VPN\u88ab\u5206\u4e3a\u4e86k\u4e2a&#xff0c;\u6bcf\u4e00\u4e2aVPNi\u90fd\u662f\u4e00\u4e2a\u6307\u5411\u7b2ci\u7ea7\u9875\u8868\u7684\u7d22\u5f15\u3002\u5f53<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"30\" src=\"2025-06-102ibvhrr4z3b.png\" width=\"90\" \/><\/p>\n<p>\u65f6&#xff0c;\u90fd\u662f\u6307\u5411\u7b2cj&#043;1\u7ea7\u7684\u67d0\u4e2a\u9875\u8868\u3002\u7b2ck\u7ea7\u9875\u8868\u4e2d\u7684\u6bcf\u4e2aPTE\u5305\u542b\u67d0\u4e2a\u7269\u7406\u9875\u9762\u7684PPN&#xff0c;\u6216\u8005\u65f6\u4e00\u4e2a\u78c1\u76d8\u5757\u7684\u5730\u5740\u3002\u4e3a\u6784\u9020\u7269\u7406\u5730\u5740&#xff0c;MMU\u9700\u8981\u8bbf\u95eek\u4e2aPTE&#xff0c;\u4e4b\u540e\u624d\u80fd\u786e\u5b9aPPN\u3002Intel Core i7\u91c7\u7528\u7684\u662f\u4e00\u4e2a\u56db\u7ea7\u9875\u8868\u5c42\u6b21\u7ed3\u6784&#xff0c;\u6bcf\u4e2aVPNi\u67099\u4f4d&#xff0c;\u5f53\u672a\u547d\u4e2d\u65f6&#xff0c;36\u4f4d\u7684VPN\u88ab\u5206\u4e3aVPN1\u3001VPN2\u3001VPN3\u3001VPN4&#xff0c;\u6bcf\u4e2aVPNi\u88ab\u7528\u4f5c\u5230\u4e00\u4e2a\u9875\u8868\u7684\u504f\u79fb\u91cf\u3002CR3\u5bc4\u5b58\u5668\u5305\u542bL1 \u9875\u8868\u7684\u7269\u7406\u5730\u5740&#xff0c;VPN1\u63d0\u4f9b\u5230\u4e00\u4e2aL1 PTE\u7684\u504f\u79fb\u91cf&#xff0c;\u8fd9\u4e2aPTE\u5305\u542b\u67d0\u4e2aL2\u9875\u8868\u7684\u57fa\u5740\u3002VPN2\u63d0\u4f9b\u5230\u8fd9\u4e2aL2\u9875\u8868\u4e2d\u67d0\u4e2aPTE\u7684\u504f\u79fb\u91cf&#xff0c;\u4ee5\u6b64\u7c7b\u63a8\u3002\u6700\u540e\u5f97\u5230\u7684L4 PTE\u5305\u542b\u4e86\u9700\u8981\u7684\u7269\u7406\u9875\u53f7&#xff0c;\u548c\u865a\u62df\u5730\u5740\u4e2d\u7684VPO\u8fde\u63a5\u8d77\u6765\u5c31\u5f97\u5230\u76f8\u5e94\u7684\u7269\u7406\u5730\u5740\u3002<\/p>\n<h3 style=\"text-align:justify\">7.5 \u4e09\u7ea7Cache\u652f\u6301\u4e0b\u7684\u7269\u7406\u5185\u5b58\u8bbf\u95ee<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u901a\u8fc7\u5185\u5b58\u5730\u5740\u7684\u7ec4\u7d22\u5f15\u83b7\u5f97\u503c&#xff0c;\u5982\u679c\u5bf9\u5e94\u7684\u503c\u662fdata\u5219\u50cfL1 d-cache\u5bf9\u5e94\u7ec4\u4e2d\u67e5\u627e&#xff0c;\u5982\u679c\u662f\u6307\u4ee4&#xff0c;\u5219\u5411L1 i-cache\u5bf9\u5e94\u7ec4\u4e2d\u67e5\u627e\u3002\u5c06L1\u5bf9\u5e94\u7ec4\u4e2d\u7684\u6bcf\u4e00\u884c\u7684\u6807\u8bb0\u4f4d\u8fdb\u884c\u5bf9\u6bd4&#xff0c;\u5982\u679c\u76f8\u540c\u5e76\u4e14\u6709\u6548\u4f4d\u4e3a1\u5219\u547d\u4e2d&#xff0c;\u83b7\u5f97\u504f\u79fb\u91cf&#xff0c;\u53d6\u51fa\u76f8\u5e94\u5b57\u8282&#xff0c;\u5426\u5219\u4e0d\u547d\u4e2d&#xff0c;\u5411\u4e0b\u4e00\u7ea7cache\u5bfb\u627e&#xff0c;\u76f4\u5230\u5411\u5185\u5b58\u4e2d\u5bfb\u627e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"514\" src=\"2025-06-10qyo4njbjzsg.png\" width=\"928\" \/><\/p>\n<h3 style=\"text-align:justify\">7.6 hello\u8fdb\u7a0bfork\u65f6\u7684\u5185\u5b58\u6620\u5c04<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f53fork\u51fd\u6570\u88ab\u8c03\u7528\u65f6&#xff0c;\u5185\u6838\u4e3a\u65b0\u8fdb\u7a0b\u521b\u5efa\u5404\u79cd\u6570\u636e\u7ed3\u6784&#xff0c;\u5e76\u5206\u914d\u7ed9\u5b83\u4e00\u4e2a\u552f\u4e00\u7684PID\u3002\u4e3a\u4e86\u7ed9\u65b0\u8fdb\u7a0b\u521b\u5efa\u865a\u62df\u5185\u5b58&#xff0c;\u5b83\u521b\u5efa\u4e86\u5f53\u524d\u8fdb\u7a0b\u7684mm_struct\u3001\u533a\u57df\u7ed3\u6784\u548c\u9875\u8868\u7684\u539f\u6837\u526f\u672c&#xff0c;\u5e76\u5c06\u4e24\u4e2a\u8fdb\u7a0b\u4e2d\u7684\u6bcf\u4e2a\u754c\u9762\u90fd\u6807\u8bb0\u4e3a\u53ea\u8bfb&#xff0c;\u5c06\u4e24\u4e2a\u8fdb\u7a0b\u4e2d\u7684\u6bcf\u4e2a\u533a\u57df\u7ed3\u6784\u90fd\u6807\u8bb0\u4e3a\u79c1\u6709\u7684\u5199\u65f6\u590d\u5236\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f53fork\u5728\u65b0\u8fdb\u7a0b\u4e2d\u8fd4\u56de\u65f6&#xff0c;\u65b0\u8fdb\u7a0b\u73b0\u5728\u7684\u865a\u62df\u5185\u5b58\u641e\u597d\u548c\u8c03\u7528fork\u65f6\u5b58\u5728\u7684\u865a\u62df\u5185\u5b58\u76f8\u540c\u3002\u8fd9\u4e24\u4e2a\u8fdb\u7a0b\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u540e\u6765\u8fdb\u884c\u5199\u64cd\u4f5c\u65f6&#xff0c;\u5199\u65f6\u590d\u5236\u673a\u5236\u5c31\u4f1a\u521b\u5efa\u65b0\u9875\u9762&#xff0c;\u56e0\u6b64&#xff0c;\u4e5f\u5c31\u4e3a\u6bcf\u4e2a\u8fdb\u7a0b\u4fdd\u6301\u4e86\u79c1\u6709\u5730\u5740\u7a7a\u95f4\u7684\u62bd\u8c61\u6982\u5ff5\u3002<\/p>\n<h3 style=\"text-align:justify\">7.7 hello\u8fdb\u7a0bexecve\u65f6\u7684\u5185\u5b58\u6620\u5c04<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">execve \u51fd\u6570\u8c03\u7528\u9a7b\u7559\u5728\u5185\u6838\u533a\u57df\u7684\u542f\u52a8\u52a0\u8f7d\u5668\u4ee3\u7801&#xff0c;\u5728\u5f53\u524d\u8fdb\u7a0b\u4e2d\u52a0\u8f7d\u5e76\u8fd0 \u884c\u5305\u542b\u5728\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6 hello \u4e2d\u7684\u7a0b\u5e8f&#xff0c;\u7528 hello \u7a0b\u5e8f\u6709\u6548\u5730\u66ff\u4ee3\u4e86\u5f53\u524d\u7a0b\u5e8f\u3002 \u52a0\u8f7d\u5e76\u8fd0\u884c hello \u9700\u8981\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">1.\u5220\u9664\u5df2\u5b58\u5728\u7684\u7528\u6237\u533a\u57df&#xff0c;\u5220\u9664\u5f53\u524d\u8fdb\u7a0b\u865a\u62df\u5730\u5740\u7684\u7528\u6237\u90e8\u5206\u4e2d\u7684\u5df2\u5b58\u5728\u7684\u533a\u57df\u7ed3\u6784\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2.\u6620\u5c04\u79c1\u6709\u533a\u57df&#xff0c;\u4e3a\u65b0\u7a0b\u5e8f\u7684\u4ee3\u7801\u3001\u6570\u636e\u3001bss \u548c\u6808\u533a\u57df\u521b\u5efa\u65b0\u7684\u533a\u57df\u7ed3 \u6784&#xff0c;\u6240\u6709\u8fd9\u4e9b\u65b0\u7684\u533a\u57df\u90fd\u662f\u79c1\u6709\u7684\u3001\u5199\u65f6\u590d\u5236\u7684\u3002\u4ee3\u7801\u548c\u6570\u636e\u533a\u57df\u88ab\u6620\u5c04\u4e3a hello \u6587\u4ef6\u4e2d\u7684.text \u548c.data \u533a&#xff0c;bss \u533a\u57df\u662f\u8bf7\u6c42\u4e8c\u8fdb\u5236\u96f6\u7684&#xff0c;\u6620\u5c04\u5230\u533f\u540d \u6587\u4ef6&#xff0c;\u5176\u5927\u5c0f\u5305\u542b\u5728 hello \u4e2d&#xff0c;\u6808\u548c\u5806\u5730\u5740\u4e5f\u662f\u8bf7\u6c42\u4e8c\u8fdb\u5236\u96f6\u7684&#xff0c;\u521d\u59cb\u957f \u5ea6\u4e3a\u96f6\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3.\u6620\u5c04\u5171\u4eab\u533a\u57df&#xff0c; hello \u7a0b\u5e8f\u4e0e\u5171\u4eab\u5bf9\u8c61 libc.so \u94fe\u63a5&#xff0c;libc.so \u662f\u52a8\u6001\u94fe \u63a5\u5230\u8fd9\u4e2a\u7a0b\u5e8f\u4e2d\u7684&#xff0c;\u7136\u540e\u518d\u6620\u5c04\u5230\u7528\u6237\u865a\u62df\u5730\u5740\u7a7a\u95f4\u4e2d\u7684\u5171\u4eab\u533a\u57df\u5185\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">4.\u8bbe\u7f6e\u7a0b\u5e8f\u8ba1\u6570\u5668&#xff08;PC&#xff09;\u3002execve \u505a\u7684\u6700\u540e\u4e00\u4ef6\u4e8b\u60c5\u5c31\u662f\u8bbe\u7f6e\u5f53\u524d\u8fdb\u7a0b \u4e0a\u4e0b\u6587\u7684\u7a0b\u5e8f\u8ba1\u6570\u5668&#xff0c;\u4f7f\u4e4b\u6307\u5411\u4ee3\u7801\u533a\u57df\u7684\u5165\u53e3\u70b9\u3002<\/p>\n<h3 style=\"text-align:justify\">7.8 \u7f3a\u9875\u6545\u969c\u4e0e\u7f3a\u9875\u4e2d\u65ad\u5904\u7406<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f3a\u9875\u6545\u969c&#xff1a;\u4e00\u4e2a\u865a\u62df\u9875\u6ca1\u88ab\u7f13\u5b58\u5728DRAM\u4e2d&#xff0c;\u5373DRAM\u7f13\u5b58\u4e0d\u547d\u4e2d\u88ab\u79f0\u4e3a\u7f3a\u9875\u3002\u5f53CPU\u5f15\u7528\u4e86\u4e00\u4e2a\u9875\u8868\u6761\u76ee\u4e2d\u7684\u4e00\u4e2a\u5b57&#xff0c;\u800c\u8be5\u9875\u8868\u6761\u76ee\u5e76\u672a\u88ab\u7f13\u5b58\u5728DRAM\u4e2d&#xff0c;\u5730\u5740\u7ffb\u8bd1\u786c\u4ef6\u4ece\u5185\u5b58\u4e2d\u8bfb\u53d6\u8be5\u9875\u8868\u6761\u76ee&#xff0c;\u4ece\u6709\u6548\u4f4d\u4e3a0\u53ef\u4ee5\u5224\u65ad\u5c1a\u672a\u88ab\u7f13\u5b58&#xff0c;\u8fdb\u800c\u89e6\u53d1\u7f3a\u9875\u5f02\u5e38\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u7f3a\u9875\u4e2d\u65ad\u5904\u7406&#xff1a;\u7f3a\u9875\u5f02\u5e38\u8c03\u7528\u7f3a\u9875\u5f02\u5e38\u5904\u7406\u7a0b\u5e8f&#xff0c;\u8be5\u7a0b\u5e8f\u4f1a\u9009\u62e9\u4e00\u4e2a\u727a\u7272\u9875&#xff0c;\u5982\u679c\u8fd9\u4e2a\u727a\u7272\u9875\u5728DRAM\u4e2d\u5df2\u88ab\u4fee\u6539&#xff0c;\u90a3\u4e48\u5c31\u5c06\u4ed6\u5199\u56de\u78c1\u76d8&#xff0c;\u4e4b\u540e\u5c06\u5f15\u7528\u7684\u865a\u62df\u9875\u590d\u5236\u5230\u5185\u5b58\u4e2d\u7684\u539f\u6765\u727a\u7272\u9875\u6240\u5728\u4f4d\u7f6e&#xff0c;\u5e76\u5bf9\u9875\u8868\u6761\u76ee\u8fdb\u884c\u66f4\u65b0&#xff0c;\u968f\u540e\u8fd4\u56de\u3002\u5f53\u5f02\u5e38\u5904\u7406\u7a0b\u5e8f\u8fd4\u56de\u65f6&#xff0c;\u5b83\u4f1a\u91cd\u65b0\u542f\u52a8\u7f3a\u9875\u7684\u6307\u4ee4&#xff0c;\u8be5\u6307\u4ee4\u4f1a\u628a\u5bfc\u81f4\u7f3a\u9875\u7684\u865a\u62df\u5730\u5740\u91cd\u53d1\u9001\u5230\u5730\u5740\u7ffb\u8bd1\u786c\u4ef6\u3002\u6b64\u65f6\u9700\u8981\u8c03\u7528\u7684\u865a\u62df\u9875\u5df2\u7ecf\u7f13\u5b58\u5230\u4e3b\u5b58\u4e2d\u4e86&#xff0c;\u5219\u9875\u547d\u4e2d\u53ef\u4ee5\u7531\u5730\u5740\u7ffb\u8bd1\u786c\u4ef6\u6b63\u5e38\u5904\u7406\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"385\" src=\"2025-06-10ov5ydiifnif.png\" width=\"969\" \/><\/p>\n<\/p>\n<h3 style=\"text-align:justify\">7.9\u52a8\u6001\u5b58\u50a8\u5206\u914d\u7ba1\u7406<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u9996\u5148&#xff0c;\u6211\u4eec\u9700\u8981\u660e\u786e\u4e00\u4e0b\u52a8\u6001\u5b58\u50a8\u5206\u914d\u7ba1\u7406\u7684\u6982\u5ff5&#xff1a;\u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\u7a0b\u5e8f\u5458\u4f7f\u7528\u52a8\u6001\u5185\u5b58\u5206\u914d\u5668&#xff0c;\u4f8b\u5982\u8c03\u7528malloc\u51fd\u6570\u4ece\u800c\u83b7\u5f97\u865a\u62df\u5185\u5b58\u3002\u5206\u914d\u5668\u5c06\u5806&#xff08;heap&#xff09;\u89c6\u4e3a\u4e00\u7ec4\u4e0d\u540c\u5927\u5c0f\u7684\u5757(blocks)\u7684\u96c6\u5408\u6765\u7ef4\u62a4\u3002\u6bcf\u4e2a\u5757\u8981\u4e48\u662f\u5df2\u5206\u914d\u7684&#xff0c;\u8981\u4e48\u662f\u7a7a\u95f2\u7684\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">7.9.1\u5806<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u52a8\u6001\u5185\u5b58\u5206\u914d\u5668\u7ef4\u62a4\u7740\u4e00\u4e2a\u8fdb\u7a0b\u7684\u865a\u62df\u5185\u5b58\u533a\u57df&#xff0c;\u79f0\u4e3a\u5806\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"318\" src=\"2025-06-10fasbadzcgul.png\" width=\"302\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:left\">\u5728\u5185\u5b58\u4e2d\u7684\u788e\u7247\u548c\u5783\u573e\u88ab\u56de\u6536\u4e4b\u540e&#xff0c;\u5185\u5b58\u4e2d\u5c31\u4f1a\u6709\u7a7a\u4f59\u7684\u7a7a\u95f4\u88ab\u95f2\u7f6e\u51fa\u6765\u3002\u8fd9\u4e9b\u7a7a\u95f4\u6709\u65f6\u4f1a\u6bd4\u8f83\u5c0f&#xff0c;\u4f46\u662f\u79ef\u5c11\u6210\u591a&#xff0c;\u64cd\u4f5c\u7cfb\u7edf\u4e0d\u77e5\u9053\u600e\u4e48\u5229\u7528\u8fd9\u4e9b\u7a7a\u95f4&#xff0c;\u5c31\u4f1a\u9020\u6210\u5f88\u591a\u7684\u6d6a\u8d39\u3002\u4e3a\u4e86\u8bb0\u5f55\u8fd9\u4e9b\u7a7a\u95f2\u5757&#xff0c;\u91c7\u7528\u9690\u5f0f\u7a7a\u95f2\u94fe\u8868\u548c\u663e\u5f0f\u7a7a\u95f2\u94fe\u8868\u7684\u65b9\u6cd5\u5b9e\u73b0\u8fd9\u4e00\u64cd\u4f5c\u3002<\/p>\n<p style=\"text-align:left\">7.9.2\u9690\u5f0f\u7a7a\u95f2\u94fe\u8868<\/p>\n<p style=\"text-align:left\">\u9996\u5148\u4e86\u89e3\u51e0\u4e2a\u6982\u5ff5&#xff1a;<\/p>\n<p style=\"text-align:left\">\u9996\u6b21\u9002\u914d (First fit)&#xff1a; \u4ece\u5934\u5f00\u59cb\u641c\u7d22\u7a7a\u95f2\u94fe\u8868&#xff0c;\u9009\u62e9\u7b2c\u4e00\u4e2a\u5408\u9002\u7684\u7a7a\u95f2\u5757: \u641c\u7d22\u65f6\u95f4\u4e0e\u603b\u5757\u6570&#xff08;\u5305\u62ec\u5df2\u5206\u914d\u548c\u7a7a\u95f2\u5757&#xff09;\u6210\u7ebf\u6027\u5173\u7cfb\u3002\u5728\u9760\u8fd1\u94fe\u8868\u8d77\u59cb\u5904\u7559\u4e0b\u5c0f\u7a7a\u95f2\u5757\u7684\u201c\u788e\u7247\u201d\u3002<\/p>\n<p style=\"text-align:left\">\u4e0b\u4e00\u6b21\u9002\u914d (Next fit)&#xff1a; \u548c\u9996\u6b21\u9002\u914d\u76f8\u4f3c&#xff0c;\u53ea\u662f\u4ece\u94fe\u8868\u4e2d\u4e0a\u4e00\u6b21\u67e5\u8be2\u7ed3\u675f\u7684\u5730\u65b9\u5f00\u59cb\u3002\u6bd4\u9996\u6b21\u9002\u5e94\u66f4\u5feb: \u907f\u514d\u91cd\u590d\u626b\u63cf\u90a3\u4e9b\u65e0\u7528\u5757\u3002\u4e00\u4e9b\u7814\u7a76\u8868\u660e&#xff0c;\u4e0b\u4e00\u6b21\u9002\u914d\u7684\u5185\u5b58\u5229\u7528\u7387\u8981\u6bd4\u9996\u6b21\u9002\u914d\u4f4e\u5f97\u591a\u3002<\/p>\n<p style=\"text-align:left\">\u6700\u4f73\u9002\u914d (Best fit)&#xff1a; \u67e5\u8be2\u94fe\u8868&#xff0c;\u9009\u62e9\u4e00\u4e2a\u6700\u597d\u7684\u7a7a\u95f2\u5757&#xff1b;\u9002\u914d&#xff0c;\u5269\u4f59\u6700\u5c11\u7a7a\u95f2\u7a7a\u95f4\u3002\u4fdd\u8bc1\u788e\u7247\u6700\u5c0f\u2014\u2014\u63d0\u9ad8\u5185\u5b58\u5229\u7528\u7387&#xff0c;\u901a\u5e38\u8fd0\u884c\u901f\u5ea6\u4f1a\u6162\u4e8e\u9996\u6b21\u9002\u914d\u3002<\/p>\n<p style=\"text-align:left\">\u5728\u9690\u5f0f\u7a7a\u95f2\u94fe\u8868\u5de5\u4f5c\u65f6&#xff0c;\u5982\u679c\u5206\u914d\u5757\u6bd4\u7a7a\u95f2\u5757\u5c0f&#xff0c;\u53ef\u4ee5\u628a\u7a7a\u95f2\u5757\u5206\u4e3a\u4e24\u90e8\u5206&#xff0c;\u4e00\u90e8\u5206\u7528\u6765\u627f\u88c5\u5206\u914d\u5757&#xff0c;\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u7a7a\u95f2\u90e8\u5206\u65e0\u6cd5\u4f7f\u7528\u800c\u9020\u6210\u7684\u6d6a\u8d39\u3002\u9690\u5f0f\u94fe\u8868\u91c7\u7528\u8fb9\u754c\u6807\u8bb0\u7684\u65b9\u6cd5\u8fdb\u884c\u53cc\u5411\u5408\u5e76\u3002\u811a\u90e8\u4e0e\u5934\u90e8\u662f\u76f8\u540c\u7684&#xff0c;\u5747\u4e3a 4 \u4e2a\u5b57\u8282&#xff0c;\u7528\u6765\u5b58\u50a8\u5757\u7684\u5927\u5c0f&#xff0c;\u4ee5\u53ca\u8868\u660e\u8fd9\u4e2a\u5757\u662f\u5df2\u5206\u914d\u8fd8\u662f\u7a7a\u95f2\u5757\u3002\u540c\u65f6\u5b9a\u4f4d\u5934\u90e8\u548c\u5c3e\u90e8&#xff0c;\u662f\u4e3a\u4e86\u80fd\u591f\u4ee5\u5e38\u6570\u65f6\u95f4\u6765\u8fdb\u884c\u5757\u7684\u5408\u5e76\u3002\u65e0\u8bba\u662f\u4e0e\u4e0b\u4e00\u5757\u8fd8\u662f\u4e0e\u4e0a\u4e00\u5757\u5408\u5e76&#xff0c;\u90fd\u53ef\u4ee5\u901a\u8fc7\u4ed6\u4eec\u7684\u5934\u90e8\u6216\u5c3e\u90e8\u5f97\u77e5\u5757\u5927\u5c0f&#xff0c;\u4ece\u800c\u5b9a\u4f4d\u6574\u4e2a\u5757&#xff0c;\u907f\u514d\u4e86\u4ece\u5934\u904d\u5386\u94fe\u8868\u3002\u4f46\u4e0e\u6b64\u540c\u65f6\u4e5f\u663e\u8457\u7684\u589e\u52a0\u4e86\u989d\u5916\u7684\u5185\u5b58\u5f00\u9500\u3002\u4ed6\u4f1a\u6839\u636e\u6bcf\u4e00\u4e2a\u5185\u5b58\u5757\u7684\u811a\u90e8\u8fb9\u754c\u6807\u8bb0\u6765\u9009\u62e9\u5408\u5e76\u65b9\u5f0f&#xff0c;\u5982\u4e0b\u56fe&#xff1a;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"685\" src=\"2025-06-10hpny11zb2na.png\" width=\"934\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">7.9.3 \u663e\u5f0f\u7a7a\u95f2\u94fe\u8868<\/p>\n<p style=\"text-align:left\">\u663e\u5f0f\u7a7a\u95f2\u94fe\u8868\u53ea\u8bb0\u5f55\u7a7a\u95f2\u5757&#xff0c;\u800c\u4e0d\u662f\u6765\u8bb0\u5f55\u6240\u6709\u5757\u3002\u5b83\u7684\u601d\u8def\u662f\u7ef4\u62a4\u591a\u4e2a\u7a7a\u95f2\u94fe\u8868&#xff0c;\u6bcf\u4e2a\u94fe\u8868\u4e2d\u7684\u5757\u6709\u5927\u81f4\u76f8\u7b49\u7684\u5927\u5c0f&#xff0c;\u5206\u914d\u5668\u7ef4\u62a4\u7740\u4e00\u4e2a\u7a7a\u95f2\u94fe\u8868\u6570\u7ec4&#xff0c;\u6bcf\u4e2a\u5927\u5c0f\u7c7b\u4e00\u4e2a\u7a7a\u95f2\u94fe\u8868&#xff0c;\u5f53\u9700\u8981\u5206\u914d\u5757\u65f6\u53ea\u9700\u8981\u5728\u5bf9\u5e94\u7684\u7a7a\u95f2\u94fe\u8868\u4e2d\u641c\u7d22\u3002<\/p>\n<h3 style=\"text-align:justify\">7.10\u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"text-align:left\">\u672c\u7ae0\u4ecb\u7ecd\u4e86Hello\u548c\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u95f4\u7684\u4ea4\u6d41\u65b9\u5f0f\u3002\u4ecb\u7ecd\u4e86hello\u7684\u5b58\u50a8\u5668\u5730\u5740\u7a7a\u95f4\u3001intel\u7684\u6bb5\u5f0f\u7ba1\u7406\u3001hello\u7684\u9875\u5f0f\u7ba1\u7406&#xff0c;\u4ecb\u7ecd\u4e86Hello\u662f\u5982\u4f55\u7ecf\u8fc7\u5730\u5740\u7ffb\u8bd1\u4ece\u800c\u627e\u5230\u6700\u7ec8\u7684\u7269\u7406\u5730\u5740\u3002\u9610\u91ca\u4e86TLB\u52a0\u901f\u5730\u5740\u7ffb\u8bd1\u3001\u591a\u7ea7\u7f13\u5b58\u4ee5\u53ca\u52a8\u6001\u5185\u5b58\u7ba1\u7406\u76f8\u5173\u7684\u8981\u70b9\u3002\u6700\u540e&#xff0c;\u672c\u7ae0\u4ecb\u7ecd\u4e86\u52a8\u6001\u5b58\u50a8\u5206\u914d\u7ba1\u7406\u673a\u5236\u3002<\/p>\n<h2 style=\"text-align:center\"> \u7b2c8\u7ae0 hello\u7684IO\u7ba1\u7406<\/h2>\n<h3 style=\"text-align:justify\">8.1 Linux\u7684IO\u8bbe\u5907\u7ba1\u7406\u65b9\u6cd5<\/h3>\n<p style=\"margin-left:0pt;text-align:justify\">\u4e00\u4e2aLinux\u6587\u4ef6\u5c31\u662f\u4e00\u4e2am\u4e2a\u5b57\u8282\u7684\u5e8f\u5217&#xff0c;\u6240\u6709\u7684I\/O\u8bbe\u5907\u90fd\u88ab\u6a21\u578b\u5316\u4e3a\u6587\u4ef6&#xff0c;\u6240\u6709\u7684\u8f93\u5165\u8f93\u51fa\u90fd\u88ab\u5f53\u4f5c\u662f\u6587\u4ef6\u7684\u8bfb\u548c\u5199\u6765\u6267\u884c\u3002\u8fd9\u79cd\u5c06\u8bbe\u5907\u4f18\u96c5\u5730\u6620\u5c04\u4e3a\u6587\u4ef6\u7684\u65b9\u5f0f&#xff0c;\u5141\u8bb8Linux\u5185\u6838\u5f15\u51fa\u4e00\u4e2a\u7b80\u5355\u4f4e\u7ea7\u7684\u5e94\u7528\u63a5\u53e3&#xff0c;\u88ab\u79f0\u4e3a\u662fUnix I\/O&#xff0c;\u8fd9\u4f7f\u5f97\u6240\u6709\u7684\u8f93\u5165\u548c\u8f93\u51fa\u90fd\u80fd\u591f\u4ee5\u4e00\u79cd\u7edf\u4e00\u4e14\u4e00\u81f4\u7684\u65b9\u5f0f\u6765\u6267\u884c\u3002<\/p>\n<h3 style=\"text-align:justify\">8.2 \u7b80\u8ff0Unix IO\u63a5\u53e3\u53ca\u5176\u51fd\u6570<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">1.Unix\u63a5\u53e3&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;\u6253\u5f00\u6587\u4ef6&#xff1a;\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u901a\u8fc7\u5185\u6838\u6253\u5f00\u6587\u4ef6&#xff0c;\u6765\u5ba3\u544a\u5b83\u60f3\u8bbf\u95ee\u4e00\u4e2aI\/O\u8bbe\u5907&#xff0c;\u5185\u6838\u8fd4\u56de\u4e00\u4e2a\u5c0f\u7684\u975e\u8d1f\u6574\u6570&#xff0c;\u53eb\u505a\u63cf\u8ff0\u7b26&#xff0c;\u5b83\u5728\u540e\u7eed\u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u64cd\u4f5c\u4e2d\u6807\u8bc6\u8fd9\u4e2a\u6587\u4ef6&#xff0c;\u5185\u6838\u8bb0\u5f55\u6709\u5173\u8fd9\u4e2a\u6253\u5f00\u6587\u4ef6\u7684\u6240\u6709\u4fe1\u606f\u3002\u5e94\u7528\u7a0b\u5e8f\u53ea\u9700\u8bb0\u4f4f\u8fd9\u4e2a\u63cf\u8ff0\u7b26\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;I\/O\u8bbe\u5907&#xff1a;\u5185\u6838\u8fd4\u56de\u4e00\u4e2a\u5c0f\u7684\u975e\u8d1f\u6574\u6570&#xff0c;\u53eb\u505a\u63cf\u8ff0\u7b26&#xff0c;\u5b83\u5728\u540e\u7eed\u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u64cd\u4f5c\u4e2d\u6807\u8bc6\u8fd9\u4e2a\u6587\u4ef6&#xff0c;\u5185\u6838\u8bb0\u5f55\u6709\u5173\u8fd9\u4e2a\u6253\u5f00\u6587\u4ef6\u7684\u6240\u6709\u4fe1\u606f\u3002\u5e94\u7528\u7a0b\u5e8f\u53ea\u9700\u8bb0\u4f4f\u8fd9\u4e2a\u63cf\u8ff0\u7b26\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;3&#xff09;\u6539\u53d8\u5f53\u524d\u7684\u6587\u4ef6\u4f4d\u7f6e&#xff1a;\u5bf9\u4e8e\u6bcf\u4e2a\u6253\u5f00\u7684\u6587\u4ef6&#xff0c;\u5185\u6838\u4fdd\u6301\u7740\u4e00\u4e2a\u6587\u4ef6\u4f4d\u7f6ek&#xff0c;\u521d\u59cb\u4e3a0&#xff0c;\u8fd9\u4e2a\u6587\u4ef6\u4f4d\u7f6e\u662f\u4ece\u6587\u4ef6\u5f00\u5934\u8d77\u59cb\u7684\u5b57\u8282\u504f\u79fb\u91cf&#xff0c;\u5e94\u7528\u7a0b\u5e8f\u80fd\u591f\u901a\u8fc7\u6267\u884cseek&#xff0c;\u663e\u5f0f\u5730\u5c06\u6539\u53d8\u5f53\u524d\u6587\u4ef6\u4f4d\u7f6ek\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;4&#xff09;\u8bfb\u5199\u6587\u4ef6&#xff1a;\u4e00\u4e2a\u8bfb\u64cd\u4f5c\u5c31\u662f\u4ece\u6587\u4ef6\u590d\u5236n&gt;0\u4e2a\u5b57\u8282\u5230\u5185\u5b58&#xff0c;\u4ece\u5f53\u524d\u6587\u4ef6\u4f4d\u7f6ek\u5f00\u59cb&#xff0c;\u7136\u540e\u5c06k\u589e\u52a0\u5230k&#043;n&#xff0c;\u7ed9\u5b9a\u4e00\u4e2a\u5927\u5c0f\u4e3am\u5b57\u8282\u7684\u800c\u6587\u4ef6&#xff0c;\u5f53k&gt;&#061;m\u65f6&#xff0c;\u89e6\u53d1EOF\u3002\u7c7b\u4f3c\u4e00\u4e2a\u5199\u64cd\u4f5c\u5c31\u662f\u4ece\u5185\u5b58\u4e2d\u590d\u5236n&gt;0\u4e2a\u5b57\u8282\u5230\u4e00\u4e2a\u6587\u4ef6&#xff0c;\u4ece\u5f53\u524d\u6587\u4ef6\u4f4d\u7f6ek\u5f00\u59cb&#xff0c;\u7136\u540e\u66f4\u65b0k\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;5&#xff09;\u5173\u95ed\u6587\u4ef6&#xff1a;\u5f53\u5e94\u7528\u5b8c\u6210\u4e86\u5bf9\u6587\u4ef6\u7684\u8bbf\u95ee\u4e4b\u540e&#xff0c;\u5b83\u5c31\u901a\u77e5\u5185\u6838\u5173\u95ed\u8fd9\u4e2a\u6587\u4ef6&#xff0c;\u4f5c\u4e3a\u54cd\u5e94&#xff0c;\u5185\u6838\u91ca\u653e\u6587\u4ef6\u6253\u5f00\u65f6\u521b\u5efa\u7684\u6570\u636e\u7ed3\u6784&#xff0c;\u5e76\u5c06\u8fd9\u4e2a\u63cf\u8ff0\u7b26\u6062\u590d\u5230\u53ef\u7528\u7684\u63cf\u8ff0\u7b26\u6c60\u4e2d\u3002\u65e0\u8bba\u4e00\u4e2a\u8fdb\u7a0b\u56e0\u4e3a\u4f55\u79cd\u539f\u56e0\u7ec8\u6b62\u65f6&#xff0c;\u5185\u6838\u90fd\u4f1a\u5173\u95ed\u6240\u6709\u6253\u5f00\u7684\u6587\u4ef6\u5e76\u91ca\u653e\u4ed6\u4eec\u7684\u5185\u5b58\u8d44\u6e90\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2.Unix I\/O\u51fd\u6570&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;1&#xff09;int open(char *filename, int flags, mode_t mode);<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fdb\u7a0b\u901a\u8fc7\u8c03\u7528open\u51fd\u6570\u6253\u5f00\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u6587\u4ef6\u6216\u8005\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\u3002open\u51fd\u6570\u5c06filename\u8f6c\u6362\u4e3a\u4e00\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26&#xff0c;\u5e76\u4e14\u8fd4\u56de\u63cf\u8ff0\u7b26\u6570\u5b57\u3002\u8fd4\u56de\u7684\u63cf\u8ff0\u7b26\u603b\u662f\u5728\u8fdb\u7a0b\u4e2d\u5f53\u524d\u6ca1\u6709\u6253\u5f00\u7684\u6700\u5c0f\u63cf\u8ff0\u7b26\u3002flags\u53c2\u6570\u6307\u660e\u4e86\u8fdb\u7a0b\u6253\u7b97\u5982\u4f55\u8bbf\u95ee\u8fd9\u4e2a\u6587\u4ef6&#xff1a;O_RDONLY&#xff1a;\u53ea\u8bfb\u3001O_WRONLY&#xff1a;\u53ea\u5199\u548cO_RDWR\u53ef\u8bfb\u53ef\u5199\u3002mode\u53c2\u6570\u6307\u5b9a\u4e86\u65b0\u6587\u4ef6\u7684\u8bbf\u95ee\u6743\u9650\u4f4d\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;2&#xff09;int close(fd)&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0\u8fdb\u7a0b\u8c03\u7528close\u51fd\u6570\u5173\u95ed\u4e00\u4e2a\u6253\u5f00\u7684\u6587\u4ef6&#xff0c;fd\u662f\u9700\u8981\u5173\u95ed\u7684\u6587\u4ef6\u7684\u63cf\u8ff0\u7b26\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;3&#xff09;ssize_t read(int fd, void *buf, size_t n);<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">read\u51fd\u6570\u4ece\u63cf\u8ff0\u7b26\u4e3afd\u7684\u5f53\u524d\u6587\u4ef6\u4f4d\u7f6e\u8d4b\u503c\u6700\u591an\u4e2a\u5b57\u8282\u5230\u5185\u5b58\u4f4d\u7f6ebuf\u3002\u8fd4\u56de\u503c-1\u8868\u793a\u4e00\u4e2a\u9519\u8bef&#xff0c;0\u8868\u793aEOF&#xff08;End Of File&#xff09;&#xff0c;\u5426\u5219\u8fd4\u56de\u503c\u8868\u793a\u7684\u662f\u5b9e\u9645\u4f20\u9001\u7684\u5b57\u8282\u6570\u91cf\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">&#xff08;4&#xff09;ssize_t write(int fd, const void *buf, size_t n);<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u00a0write\u51fd\u6570\u4ece\u5185\u5b58\u4f4d\u7f6ebuf\u590d\u5236\u81f3\u591an\u4e2a\u5b57\u8282\u5230\u63cf\u8ff0\u7b26\u4e3afd\u7684\u5f53\u524d\u6587\u4ef6\u4f4d\u7f6e\u3002<\/p>\n<h3 style=\"text-align:justify\">8.3 printf\u7684\u5b9e\u73b0\u5206\u6790<\/h3>\n<p style=\"margin-left:.0001pt;text-align:justify\">printf\u7684\u5177\u4f53\u51fd\u6570\u4f53\u5b9e\u73b0\u8fc7\u7a0b\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"306\" src=\"2025-06-102scgyjqa1nm.png\" width=\"921\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">printf\u7a0b\u5e8f\u6309\u7167\u683c\u5f0ffmt\u7ed3\u5408\u53c2\u6570args\u751f\u6210\u683c\u5f0f\u5316\u4e4b\u540e\u7684\u5b57\u7b26\u4e32&#xff0c;\u5e76\u8fd4\u56de\u5b57\u4e32\u7684\u957f\u5ea6\u3002printf\u7528\u4e86\u4e24\u4e2a\u5916\u90e8\u51fd\u6570&#xff0c;\u4e00\u4e2a\u662fvsprintf&#xff0c;\u8fd8\u6709\u4e00\u4e2a\u662fwrite\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">vsprintf\u51fd\u6570\u4f53\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">vsprintf\u51fd\u6570\u4f5c\u7528\u662f\u63a5\u53d7\u786e\u5b9a\u8f93\u51fa\u683c\u5f0f\u7684\u683c\u5f0f\u5b57\u7b26\u4e32fmt\u3002\u7528\u683c\u5f0f\u5b57\u7b26\u4e32\u5bf9\u4e2a\u6570\u53d8\u5316\u7684\u53c2\u6570\u8fdb\u884c\u683c\u5f0f\u5316&#xff0c;\u4ea7\u751f\u683c\u5f0f\u5316\u8f93\u51fa\u3002write\u51fd\u6570\u5c06buf\u4e2d\u7684i\u4e2a\u5143\u7d20\u5199\u5230\u7ec8\u7aef\u3002\u5728unistd.h\u5934\u6587\u4ef6\u4e2d&#xff0c;\u6211\u4eec\u53ef\u4ee5\u627e\u5230write\u51fd\u6570\u7684\u58f0\u660e&#xff1a;<\/p>\n<p style=\"text-align:left\">\n<p style=\"text-align:left\">write()\u51fd\u6570\u6709\u4e09\u4e2a\u53c2\u6570&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">fd: \u6587\u4ef6\u63cf\u8ff0\u7b26&#xff0c;\u6807\u8bc6\u5f85\u5199\u5165\u7684\u6587\u4ef6\u6216\u8005\u5957\u63a5\u5b57\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">buf: \u6307\u5411\u8981\u5199\u5165\u7684\u6570\u636e\u7684\u7f13\u51b2\u533a\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">count: \u8981\u5199\u5165\u7684\u5b57\u8282\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8fd4\u56de\u503c\u4e3a\u5b9e\u9645\u5199\u5165\u7684\u5b57\u8282\u6570&#xff0c;\u9519\u8bef\u65f6\u8fd4\u56de-1&#xff0c;\u5e76\u8bbe\u7f6eerrno\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u4ecevsprintf\u751f\u6210\u663e\u793a\u4fe1\u606f&#xff0c;\u5230write\u7cfb\u7edf\u51fd\u6570&#xff0c;\u5230\u9677\u9631-\u7cfb\u7edf\u8c03\u7528 int 0x80\u6216syscall\u7b49\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5b57\u7b26\u663e\u793a\u9a71\u52a8\u5b50\u7a0b\u5e8f&#xff1a;\u4eceASCII\u5230\u5b57\u6a21\u5e93\u5230\u663e\u793avram&#xff08;\u5b58\u50a8\u6bcf\u4e00\u4e2a\u70b9\u7684RGB\u989c\u8272\u4fe1\u606f&#xff09;\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u663e\u793a\u82af\u7247\u6309\u7167\u5237\u65b0\u9891\u7387\u9010\u884c\u8bfb\u53d6vram&#xff0c;\u5e76\u901a\u8fc7\u4fe1\u53f7\u7ebf\u5411\u6db2\u6676\u663e\u793a\u5668\u4f20\u8f93\u6bcf\u4e00\u4e2a\u70b9&#xff08;RGB\u5206\u91cf&#xff09;\u3002<\/p>\n<h3 style=\"text-align:justify\">8.4 getchar\u7684\u5b9e\u73b0\u5206\u6790<\/h3>\n<p style=\"text-align:left\">getchar()\u51fd\u6570\u7684\u5177\u4f53\u5b9e\u73b0\u5982\u4e0b&#xff1a;<\/p>\n<p style=\"text-align:left\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"445\" src=\"2025-06-10ub3vutl1cdx.png\" width=\"853\" \/><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">getchar\u51fd\u6570\u8c03\u7528\u4e86read\u51fd\u6570&#xff0c;\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528read\u8bfb\u53d6\u5b58\u50a8\u5728\u952e\u76d8\u7f13\u51b2\u533a\u7684ASCII\u7801&#xff0c;\u76f4\u5230\u8bfb\u5230\u56de\u8f66\u7b26\u624d\u8fd4\u56de\u3002\u4e0d\u8fc7read\u51fd\u6570\u6bcf\u6b21\u4f1a\u628a\u6240\u6709\u5185\u5bb9\u8bfb\u8fdb\u7f13\u51b2\u533a&#xff0c;\u5982\u679c\u7f13\u51b2\u533a\u672c\u6765\u975e\u7a7a&#xff0c;\u5219\u4e0d\u4f1a\u8c03\u7528read\u51fd\u6570&#xff0c;\u800c\u662f\u7b80\u5355\u7684\u8fd4\u56de\u7f13\u51b2\u533a\u6700\u524d\u9762\u7684\u5143\u7d20\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f02\u6b65\u5f02\u5e38-\u952e\u76d8\u4e2d\u65ad\u7684\u5904\u7406&#xff1a;\u952e\u76d8\u4e2d\u65ad\u5904\u7406\u5b50\u7a0b\u5e8f\u3002\u63a5\u53d7\u6309\u952e\u626b\u63cf\u7801\u8f6c\u6210ascii\u7801&#xff0c;\u4fdd\u5b58\u5230\u7cfb\u7edf\u7684\u952e\u76d8\u7f13\u51b2\u533a\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">getchar\u7b49\u8c03\u7528read\u7cfb\u7edf\u51fd\u6570&#xff0c;\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\u8bfb\u53d6\u6309\u952eascii\u7801&#xff0c;\u76f4\u5230\u63a5\u53d7\u5230\u56de\u8f66\u952e\u624d\u8fd4\u56de\u3002<\/p>\n<h3 style=\"text-align:justify\">8.5\u672c\u7ae0\u5c0f\u7ed3<\/h3>\n<p style=\"margin-left:0pt;text-align:justify\">\u672c\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86hello\u7684I\/O\u7ba1\u7406\u673a\u5236&#xff0c;\u5148\u7b80\u8ff0\u4e86I\/O\u8bbe\u5907\u88ab\u62bd\u8c61\u4e3a\u6587\u4ef6\u7684\u73b0\u8c61&#xff0c;\u968f\u540e\u4ecb\u7ecd\u4e86I\/O\u7684\u8bbe\u5907\u7ba1\u7406\u65b9\u6cd5\u2014\u2014unix IO\u63a5\u53e3&#xff0c;\u968f\u540e\u5bf9unixIO\u63a5\u53e3\u505a\u4e86\u4ecb\u7ecd\u4e4b\u540e&#xff0c;\u7ed9\u51fa\u4e86Unix IO\u63a5\u53e3\u7684\u76f8\u5173\u51fd\u6570&#xff0c;\u5e76\u5728\u6b64\u57fa\u7840\u4e0a&#xff0c;\u5bf9printf\u548cgetchar\u7684\u5b9e\u73b0\u539f\u7406\u8fdb\u884c\u4e86\u4ecb\u7ecd\u3002<\/p>\n<h2 style=\"text-align:center\">\u7ed3\u8bba<\/h2>\n<p style=\"margin-left:.0001pt;text-align:justify\">hello\u8fd9\u4e2a\u8ba1\u7b97\u673a\u4e16\u754c\u6700\u57fa\u672c\u7684\u7a0b\u5e8f&#xff0c;\u4ece\u51fa\u751f&#xff08;\u7f16\u5199\u5b8c\u6210&#xff09;\u5230\u6b7b\u4ea1&#xff08;\u8fdb\u7a0b\u88ab\u56de\u6536&#xff09;\u603b\u5171\u7ecf\u5386\u4e86\u5982\u4e0b\u51e0\u4e2a\u6b65\u9aa4&#xff1a;<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">1\u3001\u9884\u5904\u7406(cpp)\u3002\u5c06hello.c\u8fdb\u884c\u9884\u5904\u7406&#xff0c;\u5c06\u6587\u4ef6\u8c03\u7528\u7684\u6240\u6709\u5916\u90e8\u5e93\u6587\u4ef6\u5408\u5e76\u5c55\u5f00&#xff0c;\u751f\u6210\u4e00\u4e2a\u7ecf\u8fc7\u4fee\u6539\u7684hello.i\u6587\u4ef6\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">2\u3001\u7f16\u8bd1(ccl)\u3002\u5c06hello.i\u6587\u4ef6\u7ffb\u8bd1\u6210\u4e3a\u4e00\u4e2a\u5305\u542b\u6c47\u7f16\u8bed\u8a00\u7684\u6587\u4ef6hello.s\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">3\u3001\u6c47\u7f16(as)\u3002\u5c06hello.s\u7ffb\u8bd1\u6210\u4e3a\u4e00\u4e2a\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6hello.o\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">4\u3001\u94fe\u63a5(ld)\u3002\u5c06hello.o\u6587\u4ef6\u548c\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6\u548c\u52a8\u6001\u94fe\u63a5\u5e93\u94fe\u63a5\u8d77\u6765&#xff0c;\u751f\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u76ee\u6807\u6587\u4ef6hello\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">5\u3001\u8fd0\u884c\u3002\u5728shel1\u4e2d\u8f93\u5165.\/hello 2022112040\u00a0qdx 15845895165 4 \u5e76\u56de\u8f66\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">6\u3001\u521b\u5efa\u8fdb\u7a0b\u3002\u7ec8\u7aef\u5224\u65ad\u8f93\u5165\u7684\u6307\u4ee4\u4e0d\u662fshell\u5185\u7f6e\u6307\u4ee4&#xff0c;\u4e8e\u662f\u8c03\u7528fork\u51fd\u6570\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5b50\u8fdb\u7a0b\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">7\u3001\u52a0\u8f7d\u7a0b\u5e8f\u3002shell\u8c03\u7528execve\u51fd\u6570&#xff0c;\u542f\u52a8\u52a0\u8f7d\u5668&#xff0c;\u6620\u5c04\u865a\u62df\u5185\u5b58&#xff0c;\u8fdb\u5165\u7a0b\u5e8f\u5165\u53e3\u540e\u7a0b\u5e8f\u5f00\u59cb\u8f7d\u5165\u7269\u7406\u5185\u5b58&#xff0c;\u7136\u540e\u8fdb\u5165main\u51fd\u6570\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">8\u3001\u6267\u884c\u6307\u4ee4&#xff1a;CPU\u4e3a\u8fdb\u7a0b\u5206\u914d\u65f6\u95f4\u7247&#xff0c;\u5728\u4e00\u4e2a\u65f6\u95f4\u7247\u4e2d&#xff0c;hello\u4eab\u6709CPU\u8d44\u6e90&#xff0c;\u987a\u5e8f\u6267\u884c\u81ea\u5df1\u7684\u63a7\u5236\u903b\u8f91\u6d41\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">9\u3001\u8bbf\u95ee\u5185\u5b58&#xff1a;MU\u5c06\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u7684\u865a\u62df\u5185\u5b58\u5730\u5740\u901a\u8fc7\u9875\u8868\u6620\u5c04\u6210\u7269\u7406\u5730\u5740\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">10\u3001\u4fe1\u53f7\u7ba1\u7406&#xff1a;\u5f53\u7a0b\u5e8f\u5728\u8fd0\u884c\u7684\u65f6\u5019\u6211\u4eec\u8f93\u5165Ctrl&#043;c,\u5185\u6838\u4f1a\u53d1\u9001SIGINT\u4fe1\u53f7\u7ed9\u8fdb\u7a0b\u5e76\u7ec8\u6b62\u524d\u53f0\u4f5c\u4e1a\u3002\u5f53\u8f93\u5165Ctrl&#043;z\u65f6&#xff0c;\u5185\u6838\u4f1a\u53d1\u9001SIGTSTP\u4fe1\u53f7\u7ed9\u8fdb\u7a0b&#xff0c;\u5e76\u5c06\u524d\u53f0\u4f5c\u4e1a\u505c\u6b62\u6302\u8d77\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">11\u3001\u7ec8\u6b62&#xff1a;\u5f53\u5b50\u8fdb\u7a0b\u6267\u884c\u5b8c\u6210\u65f6&#xff0c;\u5185\u6838\u5b89\u6392\u7236\u8fdb\u7a0b\u56de\u6536\u5b50\u8fdb\u7a0b&#xff0c;\u5c06\u5b50\u8fdb\u7a0b\u7684\u9000\u51fa\u72b6\u6001\u4f20\u9012\u7ed9\u7236\u8fdb\u7a0b\u3002\u5185\u6838\u5220\u9664\u4e3a\u8fd9\u4e2a\u8fdb\u7a0b\u521b\u5efa\u7684\u6240\u6709\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\n<p style=\"margin-left:.0001pt;text-align:justify\">\u5f53\u4e0b\u5b66\u4e60\u8ba1\u7b97\u673a\u7684\u521d\u5b66\u8005&#xff0c;\u5728\u96c6\u6210IDE\u73af\u5883\u4e2d\u8f93\u5165\u51e0\u884c\u4ee3\u7801&#xff0c;\u70b9\u51fb\u8fd0\u884c\u4fbf\u53ef\u4ee5\u5b8c\u6210\u201chello,world\u201d\u7684\u8f93\u51fa\u3002\u770b\u4f3c\u662f\u5f39\u6307\u4e00\u6325\u95f4\u7684\u4e8b\u60c5&#xff0c;\u5728\u8ba1\u7b97\u673a\u7684\u89d2\u5ea6\u770b\u5374\u9700\u8981\u7ecf\u5386\u6570\u5341\u4e2a\u6b65\u9aa4&#xff0c;\u5b8c\u6210\u591a\u4e2a\u6a21\u5757\u7684\u5e76\u884c\u8c03\u7528\u3002\u4ece\u6676\u4f53\u7ba1\u5f0f\u8ba1\u7b97\u673a\u5230\u96c6\u6210\u82af\u7247&#xff0c;\u4eceENIAC\u5927\u578b\u673a\u5230\u5982\u4eca\u968f\u5904\u53ef\u89c1\u7684X86-64\u67b6\u6784\u3001arm\u67b6\u6784\u8ba1\u7b97\u673a&#xff0c;\u4ece\u6c47\u7f16\u8bed\u8a00\u5230\u5982\u4eca\u7684C,python,java&#8230;&#8230;\u65e0\u6570\u8ba1\u7b97\u673a\u5de5\u7a0b\u5e08\u524d\u8d74\u540e\u7ee7\u5730\u5b8c\u5584\u7740\u8ba1\u7b97\u673a\u7684\u4f53\u7cfb\u7ed3\u6784&#xff0c;\u4f7f\u8ba1\u7b97\u673a\u771f\u6b63\u6210\u4e3a\u4e86\u4e00\u95e8\u6267\u56e0\u7d22\u679c\u7684\u79d1\u5b66\u3002\u540c\u65f6&#xff0c;\u4e5f\u4e3a\u4fe1\u606f\u9769\u547d\u7684\u6df1\u5316\u8fdb\u4e00\u6b65\u6dfb\u7816\u52a0\u74e6\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">Hello\u7684\u4e00\u751f\u544a\u8bc9\u6211\u4eec&#xff0c;\u8ba1\u7b97\u673a\u79d1\u5b66\u7684\u9886\u57df&#xff0c;\u6ca1\u6709\u987a\u7406\u6210\u7ae0&#xff0c;\u6ca1\u6709\u7406\u6240\u5f53\u7136&#xff0c;\u4e00\u5207\u770b\u4f3c\u5bb9\u6613\u7684\u64cd\u4f5c\u90fd\u5efa\u7acb\u5728\u524d\u4eba\u4f1f\u5927\u800c\u5de7\u5999\u7684\u6784\u601d\u4e4b\u4e0a\u3002\u8ba1\u7b97\u673a\u9886\u57df\u7684\u5b66\u4e60\u9700\u8981\u6f5c\u5fc3\u6df1\u5165\u3001\u6b62\u4e8e\u81f3\u5584\u3002<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">\u8bf7\u9a84\u50b2\u5730\u62ac\u8d77\u5934\u5427&#xff0c;\u7a0b\u5e8f\u5458\u4eec\u3002\u4f60\u4eec\u4e0d\u4ec5\u662f\u5de5\u7a0b\u5e08&#xff0c;\u66f4\u662f\u79d1\u5b66\u5bb6\u3002\u540c\u65f6&#xff0c;\u4f60\u4eec\u4e5f\u662f\u4eba\u7c7b\u8fdb\u6b65\u4e0e\u53d1\u5c55\u7684\u4f1f\u5927\u63a2\u8def\u8005\u3002<\/p>\n<h2 style=\"text-align:center\">\u9644\u4ef6<\/h2>\n<table align=\"center\" border=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6587\u4ef6\u540d<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u529f\u80fd<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello.c<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6e90\u7a0b\u5e8f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello.i<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u9884\u5904\u7406\u540e\u5f97\u5230\u7684\u6587\u672c\u6587\u4ef6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello.s<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u7f16\u8bd1\u540e\u5f97\u5230\u7684\u6c47\u7f16\u8bed\u8a00\u6587\u4ef6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello.o<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u6c47\u7f16\u540e\u5f97\u5230\u7684\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u6587\u4ef6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello_asm.txt<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u53cd\u6c47\u7f16hello.o\u5f97\u5230\u7684\u53cd\u6c47\u7f16\u6587\u4ef6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello1_asm.txt<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u53cd\u6c47\u7f16hello\u53ef\u6267\u884c\u6587\u4ef6\u5f97\u5230\u7684\u53cd\u6c47\u7f16\u6587\u4ef6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"background-color:#ffffff;width:121.95pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">hello<\/p>\n<\/td>\n<td style=\"background-color:#ffffff;width:235.25pt\">\n<p style=\"margin-left:.0001pt;text-align:center\">\u53ef\u6267\u884c\u6587\u4ef6<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 style=\"text-align:center\">\u53c2\u8003\u6587\u732e<\/h2>\n<p style=\"margin-left:.0001pt;text-align:center\"><span style=\"color:#ff0000\">\u4e3a\u5b8c\u6210\u672c\u6b21\u5927\u4f5c\u4e1a\u4f60\u7ffb\u9605\u7684\u4e66\u7c4d\u4e0e\u7f51\u7ad9\u7b49<\/span><\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[1] \u00a0\u6797\u6765\u5174.\u00a0\u7a7a\u95f4\u63a7\u5236\u6280\u672f[M].\u00a0\u5317\u4eac&#xff1a;\u4e2d\u56fd\u5b87\u822a\u51fa\u7248\u793e&#xff0c;1992&#xff1a;25-42.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[2] \u00a0\u8f9b\u5e0c\u5b5f.\u00a0\u4fe1\u606f\u6280\u672f\u4e0e\u4fe1\u606f\u670d\u52a1\u56fd\u9645\u7814\u8ba8\u4f1a\u8bba\u6587\u96c6&#xff1a;A\u96c6[C].\u00a0\u5317\u4eac&#xff1a;\u4e2d\u56fd\u79d1\u5b66\u51fa\u7248\u793e&#xff0c;1999.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[3] \u00a0\u8d75\u8000\u4e1c. \u65b0\u65f6\u4ee3\u7684\u5de5\u4e1a\u5de5\u7a0b\u5e08[M\/OL]. \u53f0\u5317&#xff1a;\u5929\u4e0b\u6587\u5316\u51fa\u7248\u793e&#xff0c;1998\u00a0[1998-09-26]. http:\/\/www.ie.nthu.edu.tw\/info\/ie.newie.htm&#xff08;Big5&#xff09;.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[4] \u00a0\u8c0c\u9896. \u7a7a\u95f4\u4ea4\u4f1a\u63a7\u5236\u7406\u8bba\u4e0e\u65b9\u6cd5\u7814\u7a76[D]. \u54c8\u5c14\u6ee8&#xff1a;\u54c8\u5c14\u6ee8\u5de5\u4e1a\u5927\u5b66&#xff0c;1992&#xff1a;8-13.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[5]\u00a0\u00a0KANAMORI H. Shaking Without Quaking[J]. Science&#xff0c;1998&#xff0c;279&#xff08;5359&#xff09;&#xff1a;2063-2064.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[6]\u00a0 CHRISTINE M. Plant Physiology: Plant Biology in the Genome Era[J\/OL].\u00a0Science&#xff0c;1998&#xff0c;281&#xff1a;331-332[1998-09-23]. http:\/\/www.sciencemag.org\/cgi\/\u00a0collection\/anatmorp.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[7] Randal E.Bryant David R.O&#039;Hallaron.\u6df1\u5165\u7406\u89e3\u8ba1\u7b97\u673a\u7cfb\u7edf&#xff08;\u7b2c\u4e09\u7248&#xff09;.\u673a\u68b0\u5de5\u4e1a\u51fa\u7248\u793e&#xff0c;2016.<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[8] https:\/\/www.cnblogs.com\/pianist\/p\/3315801.html<\/p>\n<p style=\"margin-left:.0001pt;text-align:justify\">[9] \u00a0https:\/\/www.csd.cs.cmu.edu<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.6k\u6b21\uff0c\u70b9\u8d5e21\u6b21\uff0c\u6536\u85cf49\u6b21\u3002\u672c\u7bc7\u8bba\u6587\u7684\u76ee\u7684\u662f\u89e3\u91caC\u8bed\u8a00\u7a0b\u5e8f\u5982\u4f55\u4ece\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4ee5hello.c\u7a0b\u5e8f\u4e3a\u4f8b\uff0c\u672c\u6587\u8be6\u7ec6\u5206\u6790\u4e86\u8ba1\u7b97\u673a\u5728\u751f\u6210hello\u53ef\u6267\u884c\u6587\u4ef6\u7684\u9884\u5904\u7406\u3001\u7f16\u8bd1\u3001\u6c47\u7f16\u3001\u94fe\u63a5\u3001\u8fdb\u7a0b\u7ba1\u7406\u7b49\u6574\u4e2a\u751f\u547d\u5468\u671f\u3002_\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf\u5927\u4f5c\u4e1a<\/p>\n","protected":false},"author":2,"featured_media":42715,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,125,305],"topic":[],"class_list":["post-42735","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-125","tag-305"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/42735.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.6k\u6b21\uff0c\u70b9\u8d5e21\u6b21\uff0c\u6536\u85cf49\u6b21\u3002\u672c\u7bc7\u8bba\u6587\u7684\u76ee\u7684\u662f\u89e3\u91caC\u8bed\u8a00\u7a0b\u5e8f\u5982\u4f55\u4ece\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4ee5hello.c\u7a0b\u5e8f\u4e3a\u4f8b\uff0c\u672c\u6587\u8be6\u7ec6\u5206\u6790\u4e86\u8ba1\u7b97\u673a\u5728\u751f\u6210hello\u53ef\u6267\u884c\u6587\u4ef6\u7684\u9884\u5904\u7406\u3001\u7f16\u8bd1\u3001\u6c47\u7f16\u3001\u94fe\u63a5\u3001\u8fdb\u7a0b\u7ba1\u7406\u7b49\u6574\u4e2a\u751f\u547d\u5468\u671f\u3002_\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf\u5927\u4f5c\u4e1a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/42735.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-10T00:55:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b21cbc.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/42735.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/42735.html\",\"name\":\"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-10T00:55:10+00:00\",\"dateModified\":\"2025-06-10T00:55:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/42735.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/42735.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/42735.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/42735.html","og_locale":"zh_CN","og_type":"article","og_title":"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb3.6k\u6b21\uff0c\u70b9\u8d5e21\u6b21\uff0c\u6536\u85cf49\u6b21\u3002\u672c\u7bc7\u8bba\u6587\u7684\u76ee\u7684\u662f\u89e3\u91caC\u8bed\u8a00\u7a0b\u5e8f\u5982\u4f55\u4ece\u6e90\u4ee3\u7801\u8f6c\u6362\u4e3a\u53ef\u6267\u884c\u6587\u4ef6\u3002\u4ee5hello.c\u7a0b\u5e8f\u4e3a\u4f8b\uff0c\u672c\u6587\u8be6\u7ec6\u5206\u6790\u4e86\u8ba1\u7b97\u673a\u5728\u751f\u6210hello\u53ef\u6267\u884c\u6587\u4ef6\u7684\u9884\u5904\u7406\u3001\u7f16\u8bd1\u3001\u6c47\u7f16\u3001\u94fe\u63a5\u3001\u8fdb\u7a0b\u7ba1\u7406\u7b49\u6574\u4e2a\u751f\u547d\u5468\u671f\u3002_\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf\u5927\u4f5c\u4e1a","og_url":"https:\/\/www.wsisp.com\/helps\/42735.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-10T00:55:10+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/06\/20250610005507-6847826b21cbc.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"17 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/42735.html","url":"https:\/\/www.wsisp.com\/helps\/42735.html","name":"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-10T00:55:10+00:00","dateModified":"2025-06-10T00:55:10+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/42735.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/42735.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/42735.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u54c8\u5de5\u5927\u8ba1\u7b97\u673a\u7cfb\u7edf2024\u5927\u4f5c\u4e1a\u2014\u2014Hello\u7684\u7a0b\u5e8f\u4eba\u751f"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/42735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=42735"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/42735\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/42715"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=42735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=42735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=42735"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=42735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}