From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel-bounces@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 59ACE211211E4; Wed, 5 Sep 2018 18:39:27 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2018 18:39:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,334,1531810800"; d="scan'208";a="88024914" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga001.jf.intel.com with ESMTP; 05 Sep 2018 18:38:20 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Sep 2018 18:38:20 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 5 Sep 2018 18:38:20 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.226]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.205]) with mapi id 14.03.0319.002; Thu, 6 Sep 2018 09:38:17 +0800 From: "Dong, Eric" To: edk2-devel , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , "Yao, Jiewen" , Laszlo Ersek , "Zeng, Star" Thread-Topic: [edk2] [PATCH 2/4] UefiCpuPkg/CpuExceptionHandlerLib: support stack switch for PEI exceptions Thread-Index: AQHUQzR30vU8cvMNn0mlru4YOUcbLaTifhCA Date: Thu, 6 Sep 2018 01:38:17 +0000 Message-ID: References: <20180903031550.4440-1-jian.j.wang@intel.com> <20180903031550.4440-3-jian.j.wang@intel.com> In-Reply-To: <20180903031550.4440-3-jian.j.wang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/4] UefiCpuPkg/CpuExceptionHandlerLib: support stack switch for PEI exceptions X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 01:39:27 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] > Sent: Monday, September 3, 2018 11:16 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Dong, Eric ; Yao= , > Jiewen ; Laszlo Ersek ; Zeng, > Star > Subject: [edk2] [PATCH 2/4] UefiCpuPkg/CpuExceptionHandlerLib: support > stack switch for PEI exceptions >=20 > Stack Guard needs to setup stack switch capability to allow exception han= dler > to be called with good stack if stack overflow is detected. > This patch update InitializeCpuExceptionHandlersEx() to allow pass extra > initialization data used to setup exception stack switch for specified > exceptions. >=20 > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Ruiyu Ni > Cc: Jiewen Yao > Cc: Star Zeng > Cc: "Ware, Ryan R" > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Jian J Wang > --- > .../CpuExceptionHandlerLib/PeiCpuException.c | 27 > +++++++++++++++++++++- > .../PeiCpuExceptionHandlerLib.inf | 4 ++++ > 2 files changed, 30 insertions(+), 1 deletion(-) >=20 > diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c > index 6f271983f2..5687c98c0d 100644 > --- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c > +++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuException.c > @@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY > KIND, EITHER EXPRESS OR IMPLIED. > #include > #include > #include > +#include >=20 > CONST UINTN mDoFarReturnFlag =3D 0; >=20 > @@ -208,5 +209,29 @@ InitializeCpuExceptionHandlersEx ( > IN CPU_EXCEPTION_INIT_DATA *InitData OPTIONAL > ) > { > - return InitializeCpuExceptionHandlers (VectorInfo); > + EFI_STATUS Status; > + > + // > + // To avoid repeat initialization of default handlers, the caller > + should pass // an extended init data with InitDefaultHandlers set to > + FALSE. There's no // need to call this method to just initialize > + default handlers. Call non-ex // version instead; or this method must > + be implemented as a simple wrapper of // non-ex version of it, if this > version has to be called. > + // > + if (InitData =3D=3D NULL || InitData->Ia32.InitDefaultHandlers) { > + Status =3D InitializeCpuExceptionHandlers (VectorInfo); } else { > + Status =3D EFI_SUCCESS; > + } > + > + if (!EFI_ERROR (Status)) { > + // > + // Initializing stack switch is only necessary for Stack Guard funct= ionality. > + // > + if (PcdGetBool (PcdCpuStackGuard) && InitData !=3D NULL) { > + Status =3D ArchSetupExcpetionStack (InitData); > + } > + } > + > + return Status; > } > diff --git > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i > nf > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i > nf > index 783260e39a..0ea44b3052 100644 > --- > a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.i > nf > +++ > b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLi > +++ b.inf > @@ -60,3 +60,7 @@ > HobLib > MemoryAllocationLib > SynchronizationLib > + > +[Pcd] > + gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard > + > -- > 2.16.2.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel