From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 C28B52236BAA0 for ; Thu, 11 Jan 2018 23:57:49 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2018 00:03:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,348,1511856000"; d="scan'208";a="21022445" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 12 Jan 2018 00:03:03 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 12 Jan 2018 00:03:03 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 12 Jan 2018 00:03:03 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.189]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.159]) with mapi id 14.03.0319.002; Fri, 12 Jan 2018 16:03:01 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Wang, Jian J" , "Dong, Eric" , Laszlo Ersek Thread-Topic: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to set IDT range to RO Thread-Index: AQHTi3ugC3uL5o7gdEyFPUuZKyhjRaNv4HYQ Date: Fri, 12 Jan 2018 08:03:01 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA7B080@shsmsx102.ccr.corp.intel.com> References: <1515744104-9872-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1515744104-9872-1-git-send-email-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGI5NGEzMTctODlmZi00NGRhLWE4NWQtOTc0YjY5NWNhZDc5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiIzRUFRWXpoRmJ2bmdTUjRxQ3ZZVWtZNjRLTnlNNTJ1MEQ3RWN6d2hVNFpNdFwvdzBPdGNDa0dLYXVPclNKbkZHcyJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to set IDT range to RO X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 07:57:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen.yao@intel.com. > -----Original Message----- > From: Zeng, Star > Sent: Friday, January 12, 2018 4:02 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Yao, Jiewen ; > Wang, Jian J ; Dong, Eric ; L= aszlo > Ersek > Subject: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Remove redundant code to > set IDT range to RO >=20 > AllocateCodePages() is used to allocate buffer for IDT range, > the code pages will be set to RO in SetMemMapAttributes(), > then the code to set IDT range to RO in PatchGdtIdtMap() is > redundant and could be removed. >=20 > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Eric Dong > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > index 16664f304cde..2a4a29899862 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c > @@ -803,11 +803,10 @@ PatchGdtIdtMap ( >=20 > BaseAddress =3D gcSmiIdtr.Base; > Size =3D ALIGN_VALUE(gcSmiIdtr.Limit + 1, SIZE_4KB); > - SmmSetMemoryAttributes ( > - BaseAddress, > - Size, > - EFI_MEMORY_RO > - ); > + // > + // The range should have been set to RO > + // if it is allocated with EfiRuntimeServicesCode. > + // > SmmSetMemoryAttributes ( > BaseAddress, > Size, > -- > 2.7.0.windows.1