From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F2BFC82076 for ; Mon, 12 Dec 2016 23:09:33 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 12 Dec 2016 23:09:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,340,1477983600"; d="scan'208";a="201961618" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 12 Dec 2016 23:09:33 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 12 Dec 2016 23:09:33 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 12 Dec 2016 23:09:32 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.11]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.97]) with mapi id 14.03.0248.002; Tue, 13 Dec 2016 15:09:30 +0800 From: "Fan, Jeff" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Kinney, Michael D" , Laszlo Ersek Thread-Topic: [edk2] [PATCH] UefiCpuPkg/PiSmmCpu: Add SMM Comm Buffer Paging Protection. Thread-Index: AQHSUIkGuPM9/XGIFUKx/bfbpuHmTKEFYh3w Date: Tue, 13 Dec 2016 07:09:30 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4C4DF533@SHSMSX103.ccr.corp.intel.com> References: <1481115245-11880-1-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1481115245-11880-1-git-send-email-jiewen.yao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzBmZTc3NjMtNDU2Yy00ZDk3LWJmYTktMmJlNzcxMzQzMThkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InlCelc1dThTaytyaG45ODhcL2daUnFDQWhBQitOZU5zZ0tMckwzQm93blBrPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpu: Add SMM Comm Buffer Paging Protection. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2016 07:09:34 -0000 Content-Language: en-US Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 UmV2aWV3ZWQtYnk6IEplZmYgRmFuIDxqZWZmLmZhbkBpbnRlbC5jb20+DQoNCi0tLS0tT3JpZ2lu YWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBlZGsyLWRldmVsIFttYWlsdG86ZWRrMi1kZXZlbC1ib3Vu Y2VzQGxpc3RzLjAxLm9yZ10gT24gQmVoYWxmIE9mIEppZXdlbiBZYW8NClNlbnQ6IFdlZG5lc2Rh eSwgRGVjZW1iZXIgMDcsIDIwMTYgODo1NCBQTQ0KVG86IGVkazItZGV2ZWxAbGlzdHMuMDEub3Jn DQpDYzogS2lubmV5LCBNaWNoYWVsIE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RW50cnksIERlc2NyaXB0b3JTaXplKTsNCisgICAgfQ0KKw0K KyAgICBNZW1vcnlNYXBFbnRyeSAgICAgID0gTkVYVF9NRU1PUllfREVTQ1JJUFRPUiAoTWVtb3J5 TWFwRW50cnksIERlc2NyaXB0b3JTaXplKTsNCisgICAgTmV4dE1lbW9yeU1hcEVudHJ5ICA9IE5F WFRfTUVNT1JZX0RFU0NSSVBUT1IgKE1lbW9yeU1hcEVudHJ5LCANCisgRGVzY3JpcHRvclNpemUp OyAgfQ0KKw0KKyAgcmV0dXJuIDsNCit9DQorDQorLyoqDQorICBUaGlzIGZ1bmN0aW9uIGNhY2hl cyB0aGUgVUVGSSBtZW1vcnkgbWFwIGluZm9ybWF0aW9uLg0KKyoqLw0KK1ZPSUQNCitHZXRVZWZp TWVtb3J5TWFwICgNCisgIFZPSUQNCisgICkNCit7DQorICBFRklfU1RBVFVTICAgICAgICAgICAg U3RhdHVzOw0KKyAgVUlOVE4gICAgICAgICAgICAgICAgIE1hcEtleTsNCisgIFVJTlQzMiAgICAg ICAgICAgICAgICBEZXNjcmlwdG9yVmVyc2lvbjsNCisgIEVGSV9NRU1PUllfREVTQ1JJUFRPUiAq TWVtb3J5TWFwOw0KKw0KKyAgREVCVUcgKChERUJVR19JTkZPLCAiR2V0VWVmaU1lbW9yeU1hcFxu IikpOw0KKw0KKyAgbVVlZmlNZW1vcnlNYXBTaXplID0gMDsNCisgIE1lbW9yeU1hcCA9IE5VTEw7 DQorICBTdGF0dXMgPSBnQlMtPkdldE1lbW9yeU1hcCAoDQorICAgICAgICAgICAgICAgICAgJm1V ZWZpTWVtb3J5TWFwU2l6ZSwNCisgICAgICAgICAgICAgICAgICBNZW1vcnlNYXAsDQorICAgICAg ICAgICAgICAgICAgJk1hcEtleSwNCisgICAgICAgICAgICAgICAgICAmbVVlZmlEZXNjcmlwdG9y U2l6ZSwNCisgICAgICAgICAgICAgICAgICAmRGVzY3JpcHRvclZlcnNpb24NCisgICAgICAgICAg ICAgICAg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3J5U2l6ZSAhPSAwKSB7DQorICAgICAgICAgIERFQlVH ICgoREVCVUdfSU5GTywgIlVlZmlNZW1vcnkgcHJvdGVjdGlvbjogMHglbHggLSAweCVseFxuIiwg UHJvdGVjdGVkTWVtb3J5QmFzZSwgUHJvdGVjdGVkTWVtb3J5QmFzZSArIFByb3RlY3RlZE1lbW9y eVNpemUpKTsNCisgICAgICAgICAgU21tU2V0TWVtb3J5QXR0cmlidXRlcyAoDQorICAgICAgICAg ICAgUHJvdGVjdGVkTWVtb3J5QmFzZSwNCisgICAgICAgICAgICBQcm90ZWN0ZWRNZW1vcnlTaXpl LA0KKyAgICAgICAgICAgIEVGSV9NRU1PUllfUlANCisgICAgICAgICAgICApOw0KKyAgICAgICAg fQ0KKyAgICAgICAgLy8NCisgICAgICAgIC8vIHRoZW4gc2V0IGEgbmV3IFByb3RlY3RlZE1lbW9y eUJhc2UNCisgICAgICAgIC8vDQorICAgICAgICBQcm90ZWN0ZWRNZW1vcnlCYXNlID0gTWVtb3J5 TWFwLT5QaHlzaWNhbFN0YXJ0Ow0KKyAgICAgICAgUHJvdGVjdGVkTWVtb3J5U2l6ZSA9IEVGSV9Q QUdFU19UT19TSVpFKChVSU5UTilNZW1vcnlNYXAtPk51bWJlck9mUGFnZXMpOw0KKyAgICAgIH0N CisgICAgICBicmVhazsNCisgICAgZGVmYXVsdDoNCisgICAgICAvLw0KKyAgICAgIC8vIFRoaXMg cmVjb3JkIGNhbiBub3QgYmUgbWVyZ2VkIHRvIHByZXZpb3VzIHJlY29yZC4NCisgICAgICAvLyBX ZSBuZWVkIHNldCBhdHRyaWJ1dGUNCisgICAgICAvLw0KKyAgICAgIGlmIChQcm90ZWN0ZWRNZW1v cnlTaXplICE9IDApIHsNCisgICAgICAgIERFQlVHICgoREVCVUdfSU5GTywgIlVlZmlNZW1vcnkg cHJvdGVjdGlvbjogMHglbHggLSAweCVseFxuIiwgUHJvdGVjdGVkTWVtb3J5QmFzZSwgUHJvdGVj dGVkTWVt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