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.20; helo=mga02.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 29DEB21962301 for ; Sun, 23 Dec 2018 18:23:00 -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 orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Dec 2018 18:23:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,390,1539673200"; d="scan'208";a="132400079" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 23 Dec 2018 18:23:00 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 23 Dec 2018 18:22:59 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.182]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Mon, 24 Dec 2018 10:22:58 +0800 From: "Dong, Eric" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , Laszlo Ersek Thread-Topic: [PATCH v1] UefiCpuPkg: Merge StuffRsb.inc files into one in UefiCpuPkg/Include Thread-Index: AQHUmP8AykfpZcc1VUCRIB0WzinmUaWNLRjg Date: Mon, 24 Dec 2018 02:22:56 +0000 Message-ID: References: <20181221072959.11168-1-hao.a.wu@intel.com> In-Reply-To: <20181221072959.11168-1-hao.a.wu@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 v1] UefiCpuPkg: Merge StuffRsb.inc files into one in UefiCpuPkg/Include 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: Mon, 24 Dec 2018 02:23:01 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong > -----Original Message----- > From: Wu, Hao A > Sent: Friday, December 21, 2018 3:30 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Dong, Eric ; Ni, > Ruiyu ; Laszlo Ersek > Subject: [PATCH v1] UefiCpuPkg: Merge StuffRsb.inc files into one in > UefiCpuPkg/Include >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1091 >=20 > Previously, when compiling NASM source files, BaseTools did not support > including files outside of the NASM source file directory. As a result, w= e > duplicated multiple copies of "StuffRsb.inc" files in UefiCpuPkg. Those I= NC > files contain the common logic to stuff the Return Stack Buffer and are > identical. >=20 > After the fix of BZ 1085: > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1085 > The above support was introduced. >=20 > Thus, this commit will merge all the StuffRsb.inc files in UefiCpuPkg int= o one > file. The merged file will be named 'StuffRsbNasm.inc' and be placed unde= r > folder UefiCpuPkg/Include/. >=20 > Cc: Eric Dong > Cc: Ruiyu Ni > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Hao Wu > --- > UefiCpuPkg/{Library/SmmCpuFeaturesLib/Ia32/StuffRsb.inc =3D> > Include/StuffRsbNasm.inc} | 3 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm > | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.nasm > | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm > | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm > | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/StuffRsb.inc = | > 55 -------------------- > UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm = | > 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm = | > 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/StuffRsb.inc = | 55 - > ------------------- > UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm = | > 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.nasm = | > 2 +- > UefiCpuPkg/PiSmmCpuDxeSmm/X64/StuffRsb.inc = | 55 - > ------------------- > 12 files changed, 10 insertions(+), 174 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/StuffRsb.inc > b/UefiCpuPkg/Include/StuffRsbNasm.inc > similarity index 94% > rename from UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/StuffRsb.inc > rename to UefiCpuPkg/Include/StuffRsbNasm.inc > index 14267c3fde..276baea906 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/StuffRsb.inc > +++ b/UefiCpuPkg/Include/StuffRsbNasm.inc > @@ -11,7 +11,8 @@ > ; > ; Abstract: > ; > -; This file provides macro definitions for stuffing the Return Stack B= uffer > (RSB). > +; This file provides macro definitions for stuffing the Return Stack B= uffer > (RSB) > +; for NASM files. > ; > ;-----------------------------------------------------------------------= ------- >=20 > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm > index 31754734bc..8c1242f978 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > %define MSR_IA32_MISC_ENABLE 0x1A0 > %define MSR_EFER 0xc0000080 > diff --git > a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.nasm > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.nasm > index bc8dbfe20b..398347c6e8 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.nasm > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > global ASM_PFX(gcStmPsd) >=20 > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm > index c0a0f98f11..4ca05bbd73 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > ; > ; Variables referrenced by C code > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm > index 3e5295986b..644d895671 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > global ASM_PFX(gcStmPsd) >=20 > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/StuffRsb.inc > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/StuffRsb.inc > deleted file mode 100644 > index 14267c3fde..0000000000 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/StuffRsb.inc > +++ /dev/null > @@ -1,55 +0,0 @@ > -;-----------------------------------------------------------------------= ------- > -; > -; Copyright (c) 2018, Intel Corporation. All rights reserved.
-; Thi= s > program and the accompanying materials -; are licensed and made available > under the terms and conditions of the BSD License -; which accompanies th= is > distribution. The full text of the license may be found at -; > http://opensource.org/licenses/bsd-license.php. > -; > -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER EXPRESS OR IMPLIED. > -; > -; Abstract: > -; > -; This file provides macro definitions for stuffing the Return Stack B= uffer > (RSB). > -; > -;-----------------------------------------------------------------------= ------- > - > -%define RSB_STUFF_ENTRIES 0x20 > - > -; > -; parameters: > -; @param 1: register to use as counter (e.g. IA32:eax, X64:rax) > -; @param 2: stack pointer to restore (IA32:esp, X64:rsp) > -; @param 3: the size of a stack frame (IA32:4, X64:8) -; -%macro StuffR= sb 3 > - mov %1, RSB_STUFF_ENTRIES / 2 > - %%Unroll1: > - call %%Unroll2 > - %%SpecTrap1: > - pause > - lfence > - jmp %%SpecTrap1 > - %%Unroll2: > - call %%StuffLoop > - %%SpecTrap2: > - pause > - lfence > - jmp %%SpecTrap2 > - %%StuffLoop: > - dec %1 > - jnz %%Unroll1 > - add %2, RSB_STUFF_ENTRIES * %3 ; Restore the stack pointer > -%endmacro > - > -; > -; RSB stuffing macros for IA32 and X64 > -; > -%macro StuffRsb32 0 > - StuffRsb eax, esp, 4 > -%endmacro > - > -%macro StuffRsb64 0 > - StuffRsb rax, rsp, 8 > -%endmacro > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm > b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm > index 6bbc339c53..3791cfa144 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > %define MSR_IA32_MISC_ENABLE 0x1A0 > %define MSR_EFER 0xc0000080 > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm > b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm > index 322b1ab556..01ab7abd58 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > extern ASM_PFX(SmmInitHandler) > extern ASM_PFX(mRebasedFlag) > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/StuffRsb.inc > b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/StuffRsb.inc > deleted file mode 100644 > index 14267c3fde..0000000000 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/StuffRsb.inc > +++ /dev/null > @@ -1,55 +0,0 @@ > -;-----------------------------------------------------------------------= ------- > -; > -; Copyright (c) 2018, Intel Corporation. All rights reserved.
-; Thi= s > program and the accompanying materials -; are licensed and made available > under the terms and conditions of the BSD License -; which accompanies th= is > distribution. The full text of the license may be found at -; > http://opensource.org/licenses/bsd-license.php. > -; > -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER EXPRESS OR IMPLIED. > -; > -; Abstract: > -; > -; This file provides macro definitions for stuffing the Return Stack B= uffer > (RSB). > -; > -;-----------------------------------------------------------------------= ------- > - > -%define RSB_STUFF_ENTRIES 0x20 > - > -; > -; parameters: > -; @param 1: register to use as counter (e.g. IA32:eax, X64:rax) > -; @param 2: stack pointer to restore (IA32:esp, X64:rsp) > -; @param 3: the size of a stack frame (IA32:4, X64:8) -; -%macro StuffR= sb 3 > - mov %1, RSB_STUFF_ENTRIES / 2 > - %%Unroll1: > - call %%Unroll2 > - %%SpecTrap1: > - pause > - lfence > - jmp %%SpecTrap1 > - %%Unroll2: > - call %%StuffLoop > - %%SpecTrap2: > - pause > - lfence > - jmp %%SpecTrap2 > - %%StuffLoop: > - dec %1 > - jnz %%Unroll1 > - add %2, RSB_STUFF_ENTRIES * %3 ; Restore the stack pointer > -%endmacro > - > -; > -; RSB stuffing macros for IA32 and X64 > -; > -%macro StuffRsb32 0 > - StuffRsb eax, esp, 4 > -%endmacro > - > -%macro StuffRsb64 0 > - StuffRsb rax, rsp, 8 > -%endmacro > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm > b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm > index 414b5ab5fa..807b309b27 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > ; > ; Variables referrenced by C code > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.nasm > b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.nasm > index 24357d5870..5ba45cd8e0 100644 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.nasm > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmInit.nasm > @@ -18,7 +18,7 @@ > ; > ;-----------------------------------------------------------------------= -------- >=20 > -%include "StuffRsb.inc" > +%include "StuffRsbNasm.inc" >=20 > extern ASM_PFX(SmmInitHandler) > extern ASM_PFX(mRebasedFlag) > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/StuffRsb.inc > b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/StuffRsb.inc > deleted file mode 100644 > index 14267c3fde..0000000000 > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/StuffRsb.inc > +++ /dev/null > @@ -1,55 +0,0 @@ > -;-----------------------------------------------------------------------= ------- > -; > -; Copyright (c) 2018, Intel Corporation. All rights reserved.
-; Thi= s > program and the accompanying materials -; are licensed and made available > under the terms and conditions of the BSD License -; which accompanies th= is > distribution. The full text of the license may be found at -; > http://opensource.org/licenses/bsd-license.php. > -; > -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER EXPRESS OR IMPLIED. > -; > -; Abstract: > -; > -; This file provides macro definitions for stuffing the Return Stack B= uffer > (RSB). > -; > -;-----------------------------------------------------------------------= ------- > - > -%define RSB_STUFF_ENTRIES 0x20 > - > -; > -; parameters: > -; @param 1: register to use as counter (e.g. IA32:eax, X64:rax) > -; @param 2: stack pointer to restore (IA32:esp, X64:rsp) > -; @param 3: the size of a stack frame (IA32:4, X64:8) -; -%macro StuffR= sb 3 > - mov %1, RSB_STUFF_ENTRIES / 2 > - %%Unroll1: > - call %%Unroll2 > - %%SpecTrap1: > - pause > - lfence > - jmp %%SpecTrap1 > - %%Unroll2: > - call %%StuffLoop > - %%SpecTrap2: > - pause > - lfence > - jmp %%SpecTrap2 > - %%StuffLoop: > - dec %1 > - jnz %%Unroll1 > - add %2, RSB_STUFF_ENTRIES * %3 ; Restore the stack pointer > -%endmacro > - > -; > -; RSB stuffing macros for IA32 and X64 > -; > -%macro StuffRsb32 0 > - StuffRsb eax, esp, 4 > -%endmacro > - > -%macro StuffRsb64 0 > - StuffRsb rax, rsp, 8 > -%endmacro > -- > 2.12.0.windows.1