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.136; helo=mga12.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 CF814210DA784 for ; Mon, 6 Aug 2018 03:21:10 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2018 03:21:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,452,1526367600"; d="scan'208";a="62875358" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga008.jf.intel.com with ESMTP; 06 Aug 2018 03:21:00 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Aug 2018 03:21:00 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.124]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.81]) with mapi id 14.03.0319.002; Mon, 6 Aug 2018 18:20:58 +0800 From: "Zeng, Star" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" CC: "Wang, Jian J" , "Zeng, Star" Thread-Topic: [edk2] [PATCH] IntelFrameworkModulePkg/Csm: Set CSM memory executable Thread-Index: AQHULWvWC+QRE3z6pkC9KOLga2IlIKSyg2RQ Date: Mon, 6 Aug 2018 10:20:57 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB8D348@shsmsx102.ccr.corp.intel.com> References: <20180806095659.250456-1-ruiyu.ni@intel.com> In-Reply-To: <20180806095659.250456-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] IntelFrameworkModulePkg/Csm: Set CSM memory executable X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Aug 2018 10:21:11 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc Jian. Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiy= u Ni Sent: Monday, August 6, 2018 5:57 PM To: edk2-devel@lists.01.org Cc: Zeng, Star Subject: [edk2] [PATCH] IntelFrameworkModulePkg/Csm: Set CSM memory executa= ble Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni Cc: Star Zeng --- .../Csm/LegacyBiosDxe/LegacyBios.c | 22 +++++++++++++++++-= ---- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c b/Intel= FrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c index 8f14687b28..f86d00b53f 100644 --- a/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c +++ b/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c @@ -64,8 +64,9 @@ AllocateLegacyMemory ( OUT EFI_PHYSICAL_ADDRESS *Result ) { - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS MemPage; + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS MemPage; + EFI_GCD_MEMORY_SPACE_DESCRIPTOR MemDesc; =20 // // Allocate Pages of memory less <=3D StartPageAddress @@ -83,10 +84,21 = @@ AllocateLegacyMemory ( // if (!EFI_ERROR (Status)) { *Result =3D (EFI_PHYSICAL_ADDRESS) (UINTN) MemPage; + if (MemoryType !=3D EfiBootServicesCode) { + // + // Make sure that the buffer can be used to store code. + // + Status =3D gDS->GetMemorySpaceDescriptor (MemPage, &MemDesc); + if (!EFI_ERROR (Status) && (MemDesc.Attributes & EFI_MEMORY_XP) !=3D= 0) { + Status =3D gDS->SetMemorySpaceAttributes ( + MemPage, + EFI_PAGES_TO_SIZE (Pages), + MemDesc.Attributes & (~EFI_MEMORY_XP) + ); + } + } } - // - // If reach here the status =3D EFI_SUCCESS - // + return Status; } =20 -- 2.16.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel