* Re: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb [not found] <172CE5E0BCC4376C.1705@groups.io> @ 2022-12-09 1:42 ` Zhiguang Liu 2022-12-09 2:40 ` Michael D Kinney 0 siblings, 1 reply; 5+ messages in thread From: Zhiguang Liu @ 2022-12-09 1:42 UTC (permalink / raw) To: devel@edk2.groups.io, Liu, Zhiguang Cc: Kinney, Michael D, Gao, Liming, Ni, Ray Hi Liming and Mike, Could you help review this patch? Thanks Zhiguang > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > Zhiguang Liu > Sent: Friday, December 2, 2022 2:25 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Kinney, Michael D > <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; > Ni, Ray <ray.ni@intel.com> > Subject: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for > CpuFlushTlb > > For different compilers, both IA32 and X64 can use Ia32/CpuFlushTlbGcc.c, > which is C code (no inline assembly code). > To simplify, remove other assemly file for CpuFlushTlb, and rename > Ia32/CpuFlushTlbGcc.c to Ia32/CpuFlushTlb.c. > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Signed-off-by: Ray Ni <ray.ni@intel.com> > Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> > --- > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 10 ++---- > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c | 12 +++---- > .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 31 ------------------ > .../Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c | 25 --------------- > .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 32 ------------------- > 5 files changed, 9 insertions(+), 101 deletions(-) delete mode 100644 > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > delete mode 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > index 6b230f6e6d..0feb592638 100644 > --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > @@ -4,7 +4,7 @@ > # CPU Library implemented using ASM functions for IA32, X64, ARM, > AARCH64, # PAL CALLs for IPF, and empty functions for EBC. > # > -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights > +reserved.<BR> > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> # > Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR> # > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights > reserved.<BR> @@ -31,16 +31,12 @@ > > [Sources.IA32] > Ia32/CpuSleep.c | MSFT > - Ia32/CpuFlushTlb.c | MSFT > - > Ia32/CpuSleep.nasm| INTEL > - Ia32/CpuFlushTlb.nasm| INTEL > - > Ia32/CpuSleepGcc.c | GCC > - Ia32/CpuFlushTlbGcc.c | GCC > + Ia32/CpuFlushTlb.c > > [Sources.X64] > - X64/CpuFlushTlb.nasm > + Ia32/CpuFlushTlb.c > X64/CpuSleep.nasm > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > index 549f4eb8a0..17a351d054 100644 > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > +++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > @@ -1,11 +1,14 @@ > /** @file > - CpuFlushTlb function. > + CpuFlushTlb function for Ia32/X64. > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> > + Copyright (c) 2006 - 2022, Intel Corporation. All rights > + reserved.<BR> Portions copyright (c) 2008 - 2009, Apple Inc. All > + rights reserved.<BR> > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > > +#include <Library/BaseLib.h> > + > /** > Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > @@ -18,8 +21,5 @@ CpuFlushTlb ( > VOID > ) > { > - _asm { > - mov eax, cr3 > - mov cr3, eax > - } > + AsmWriteCr3 (AsmReadCr3 ()); > } > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > deleted file mode 100644 > index bc3b68e3f2..0000000000 > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > +++ /dev/null > @@ -1,31 +0,0 @@ > -;------------------------------------------------------------------------------ ; -; > Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> -; SPDX- > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > -; > -; CpuFlushTlb.Asm > -; > -; Abstract: > -; > -; CpuFlushTlb function > -; > -; Notes: > -; > -;------------------------------------------------------------------------------ > - > - SECTION .text > - > -;------------------------------------------------------------------------------ > -; VOID > -; EFIAPI > -; CpuFlushTlb ( > -; VOID > -; ); > -;------------------------------------------------------------------------------ > -global ASM_PFX(CpuFlushTlb) > -ASM_PFX(CpuFlushTlb): > - mov eax, cr3 > - mov cr3, eax ; moving to CR3 flushes TLB > - ret > - > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > deleted file mode 100644 > index ee44f2ea6e..0000000000 > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > +++ /dev/null > @@ -1,25 +0,0 @@ > -/** @file > - CpuFlushTlb function for Ia32/X64 GCC. > - > - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> > - Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#include <Library/BaseLib.h> > - > -/** > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > - > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > - > -**/ > -VOID > -EFIAPI > -CpuFlushTlb ( > - VOID > - ) > -{ > - AsmWriteCr3 (AsmReadCr3 ()); > -} > diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > deleted file mode 100644 > index 8ddf7a2864..0000000000 > --- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > +++ /dev/null > @@ -1,32 +0,0 @@ > -;------------------------------------------------------------------------------ ; -; > Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> -; SPDX- > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > -; > -; CpuFlushTlb.Asm > -; > -; Abstract: > -; > -; CpuFlushTlb function > -; > -; Notes: > -; > -;------------------------------------------------------------------------------ > - > - DEFAULT REL > - SECTION .text > - > -;------------------------------------------------------------------------------ > -; VOID > -; EFIAPI > -; CpuFlushTlb ( > -; VOID > -; ); > -;------------------------------------------------------------------------------ > -global ASM_PFX(CpuFlushTlb) > -ASM_PFX(CpuFlushTlb): > - mov rax, cr3 > - mov cr3, rax > - ret > - > -- > 2.31.1.windows.1 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb 2022-12-09 1:42 ` [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb Zhiguang Liu @ 2022-12-09 2:40 ` Michael D Kinney 2022-12-09 7:24 ` Zhiguang Liu 2022-12-09 18:18 ` Michael D Kinney 0 siblings, 2 replies; 5+ messages in thread From: Michael D Kinney @ 2022-12-09 2:40 UTC (permalink / raw) To: Liu, Zhiguang, devel@edk2.groups.io, Kinney, Michael D Cc: Gao, Liming, Ni, Ray Did you use git mv to rename CpuFlushTlbGcc,c to CpuFlushTlb.c to preserve history? The log here shows a delete and new. Mike > -----Original Message----- > From: Liu, Zhiguang <zhiguang.liu@intel.com> > Sent: Thursday, December 8, 2022 5:42 PM > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb > > Hi Liming and Mike, > Could you help review this patch? > > Thanks > Zhiguang > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > Zhiguang Liu > > Sent: Friday, December 2, 2022 2:25 PM > > To: devel@edk2.groups.io > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Kinney, Michael D > > <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; > > Ni, Ray <ray.ni@intel.com> > > Subject: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for > > CpuFlushTlb > > > > For different compilers, both IA32 and X64 can use Ia32/CpuFlushTlbGcc.c, > > which is C code (no inline assembly code). > > To simplify, remove other assemly file for CpuFlushTlb, and rename > > Ia32/CpuFlushTlbGcc.c to Ia32/CpuFlushTlb.c. > > > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Signed-off-by: Ray Ni <ray.ni@intel.com> > > Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> > > --- > > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 10 ++---- > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c | 12 +++---- > > .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 31 ------------------ > > .../Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c | 25 --------------- > > .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 32 ------------------- > > 5 files changed, 9 insertions(+), 101 deletions(-) delete mode 100644 > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > delete mode 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > index 6b230f6e6d..0feb592638 100644 > > --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > @@ -4,7 +4,7 @@ > > # CPU Library implemented using ASM functions for IA32, X64, ARM, > > AARCH64, # PAL CALLs for IPF, and empty functions for EBC. > > # > > -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> > > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights > > +reserved.<BR> > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> # > > Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR> # > > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights > > reserved.<BR> @@ -31,16 +31,12 @@ > > > > [Sources.IA32] > > Ia32/CpuSleep.c | MSFT > > - Ia32/CpuFlushTlb.c | MSFT > > - > > Ia32/CpuSleep.nasm| INTEL > > - Ia32/CpuFlushTlb.nasm| INTEL > > - > > Ia32/CpuSleepGcc.c | GCC > > - Ia32/CpuFlushTlbGcc.c | GCC > > + Ia32/CpuFlushTlb.c > > > > [Sources.X64] > > - X64/CpuFlushTlb.nasm > > + Ia32/CpuFlushTlb.c > > X64/CpuSleep.nasm > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > index 549f4eb8a0..17a351d054 100644 > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > +++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > @@ -1,11 +1,14 @@ > > /** @file > > - CpuFlushTlb function. > > + CpuFlushTlb function for Ia32/X64. > > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> > > + Copyright (c) 2006 - 2022, Intel Corporation. All rights > > + reserved.<BR> Portions copyright (c) 2008 - 2009, Apple Inc. All > > + rights reserved.<BR> > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > > > +#include <Library/BaseLib.h> > > + > > /** > > Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > > @@ -18,8 +21,5 @@ CpuFlushTlb ( > > VOID > > ) > > { > > - _asm { > > - mov eax, cr3 > > - mov cr3, eax > > - } > > + AsmWriteCr3 (AsmReadCr3 ()); > > } > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > deleted file mode 100644 > > index bc3b68e3f2..0000000000 > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > +++ /dev/null > > @@ -1,31 +0,0 @@ > > -;------------------------------------------------------------------------------ ; -; > > Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> -; SPDX- > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > -; > > -; CpuFlushTlb.Asm > > -; > > -; Abstract: > > -; > > -; CpuFlushTlb function > > -; > > -; Notes: > > -; > > -;------------------------------------------------------------------------------ > > - > > - SECTION .text > > - > > -;------------------------------------------------------------------------------ > > -; VOID > > -; EFIAPI > > -; CpuFlushTlb ( > > -; VOID > > -; ); > > -;------------------------------------------------------------------------------ > > -global ASM_PFX(CpuFlushTlb) > > -ASM_PFX(CpuFlushTlb): > > - mov eax, cr3 > > - mov cr3, eax ; moving to CR3 flushes TLB > > - ret > > - > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > deleted file mode 100644 > > index ee44f2ea6e..0000000000 > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > +++ /dev/null > > @@ -1,25 +0,0 @@ > > -/** @file > > - CpuFlushTlb function for Ia32/X64 GCC. > > - > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> > > - Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> > > - SPDX-License-Identifier: BSD-2-Clause-Patent > > - > > -**/ > > - > > -#include <Library/BaseLib.h> > > - > > -/** > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > - > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > - > > -**/ > > -VOID > > -EFIAPI > > -CpuFlushTlb ( > > - VOID > > - ) > > -{ > > - AsmWriteCr3 (AsmReadCr3 ()); > > -} > > diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > deleted file mode 100644 > > index 8ddf7a2864..0000000000 > > --- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > +++ /dev/null > > @@ -1,32 +0,0 @@ > > -;------------------------------------------------------------------------------ ; -; > > Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> -; SPDX- > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > -; > > -; CpuFlushTlb.Asm > > -; > > -; Abstract: > > -; > > -; CpuFlushTlb function > > -; > > -; Notes: > > -; > > -;------------------------------------------------------------------------------ > > - > > - DEFAULT REL > > - SECTION .text > > - > > -;------------------------------------------------------------------------------ > > -; VOID > > -; EFIAPI > > -; CpuFlushTlb ( > > -; VOID > > -; ); > > -;------------------------------------------------------------------------------ > > -global ASM_PFX(CpuFlushTlb) > > -ASM_PFX(CpuFlushTlb): > > - mov rax, cr3 > > - mov cr3, rax > > - ret > > - > > -- > > 2.31.1.windows.1 > > > > > > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb 2022-12-09 2:40 ` Michael D Kinney @ 2022-12-09 7:24 ` Zhiguang Liu 2022-12-09 18:18 ` Michael D Kinney 1 sibling, 0 replies; 5+ messages in thread From: Zhiguang Liu @ 2022-12-09 7:24 UTC (permalink / raw) To: Kinney, Michael D, devel@edk2.groups.io; +Cc: Gao, Liming, Ni, Ray Hi Mike Thanks for the comment. I also think the history is confusing. Yes, I used "git mv" to rename and remove, as below: git mv MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c -f But in the patch, it shows delete and modified. (I expect it shows delete and rename, but it doesn't) Thanks Zhiguang > -----Original Message----- > From: Kinney, Michael D <michael.d.kinney@intel.com> > Sent: Friday, December 9, 2022 10:40 AM > To: Liu, Zhiguang <zhiguang.liu@intel.com>; devel@edk2.groups.io; Kinney, > Michael D <michael.d.kinney@intel.com> > Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly > for CpuFlushTlb > > Did you use git mv to rename CpuFlushTlbGcc,c to CpuFlushTlb.c to preserve > history? > > The log here shows a delete and new. > > Mike > > > -----Original Message----- > > From: Liu, Zhiguang <zhiguang.liu@intel.com> > > Sent: Thursday, December 8, 2022 5:42 PM > > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly > > for CpuFlushTlb > > > > Hi Liming and Mike, > > Could you help review this patch? > > > > Thanks > > Zhiguang > > > > > -----Original Message----- > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > Zhiguang Liu > > > Sent: Friday, December 2, 2022 2:25 PM > > > To: devel@edk2.groups.io > > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Kinney, Michael D > > > <michael.d.kinney@intel.com>; Gao, Liming > > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > > > Subject: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly > for > > > CpuFlushTlb > > > > > > For different compilers, both IA32 and X64 can use > > > Ia32/CpuFlushTlbGcc.c, which is C code (no inline assembly code). > > > To simplify, remove other assemly file for CpuFlushTlb, and rename > > > Ia32/CpuFlushTlbGcc.c to Ia32/CpuFlushTlb.c. > > > > > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > > Signed-off-by: Ray Ni <ray.ni@intel.com> > > > Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > --- > > > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 10 ++---- > > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c | 12 +++---- > > > .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 31 ------------------ > > > .../Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c | 25 --------------- > > > .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 32 ------------------- > > > 5 files changed, 9 insertions(+), 101 deletions(-) delete mode > > > 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > delete mode 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > delete mode 100644 > MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > index 6b230f6e6d..0feb592638 100644 > > > --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > @@ -4,7 +4,7 @@ > > > # CPU Library implemented using ASM functions for IA32, X64, ARM, > > > AARCH64, # PAL CALLs for IPF, and empty functions for EBC. > > > # > > > -# Copyright (c) 2007 - 2018, Intel Corporation. All rights > > > reserved.<BR> > > > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights > > > +reserved.<BR> > > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > > reserved.<BR> # Portions copyright (c) 2011 - 2013, ARM Ltd. All > > > rights reserved.<BR> # Copyright (c) 2020, Hewlett Packard > > > Enterprise Development LP. All rights reserved.<BR> @@ -31,16 +31,12 > > > @@ > > > > > > [Sources.IA32] > > > Ia32/CpuSleep.c | MSFT > > > - Ia32/CpuFlushTlb.c | MSFT > > > - > > > Ia32/CpuSleep.nasm| INTEL > > > - Ia32/CpuFlushTlb.nasm| INTEL > > > - > > > Ia32/CpuSleepGcc.c | GCC > > > - Ia32/CpuFlushTlbGcc.c | GCC > > > + Ia32/CpuFlushTlb.c > > > > > > [Sources.X64] > > > - X64/CpuFlushTlb.nasm > > > + Ia32/CpuFlushTlb.c > > > X64/CpuSleep.nasm > > > > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > index 549f4eb8a0..17a351d054 100644 > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > +++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > @@ -1,11 +1,14 @@ > > > /** @file > > > - CpuFlushTlb function. > > > + CpuFlushTlb function for Ia32/X64. > > > > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights > > > reserved.<BR> > > > + Copyright (c) 2006 - 2022, Intel Corporation. All rights > > > + reserved.<BR> Portions copyright (c) 2008 - 2009, Apple Inc. All > > > + rights reserved.<BR> > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > **/ > > > > > > +#include <Library/BaseLib.h> > > > + > > > /** > > > Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > > > > @@ -18,8 +21,5 @@ CpuFlushTlb ( > > > VOID > > > ) > > > { > > > - _asm { > > > - mov eax, cr3 > > > - mov cr3, eax > > > - } > > > + AsmWriteCr3 (AsmReadCr3 ()); > > > } > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > deleted file mode 100644 > > > index bc3b68e3f2..0000000000 > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > +++ /dev/null > > > @@ -1,31 +0,0 @@ > > > -;------------------------------------------------------------------ > > > ------------ ; -; Copyright (c) 2006, Intel Corporation. All rights > > > reserved.<BR> -; SPDX- > > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > > -; > > > -; CpuFlushTlb.Asm > > > -; > > > -; Abstract: > > > -; > > > -; CpuFlushTlb function > > > -; > > > -; Notes: > > > -; > > > -;------------------------------------------------------------------ > > > ------------ > > > - > > > - SECTION .text > > > - > > > -;------------------------------------------------------------------ > > > ------------ > > > -; VOID > > > -; EFIAPI > > > -; CpuFlushTlb ( > > > -; VOID > > > -; ); > > > -;------------------------------------------------------------------ > > > ------------ > > > -global ASM_PFX(CpuFlushTlb) > > > -ASM_PFX(CpuFlushTlb): > > > - mov eax, cr3 > > > - mov cr3, eax ; moving to CR3 flushes TLB > > > - ret > > > - > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > deleted file mode 100644 > > > index ee44f2ea6e..0000000000 > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > +++ /dev/null > > > @@ -1,25 +0,0 @@ > > > -/** @file > > > - CpuFlushTlb function for Ia32/X64 GCC. > > > - > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights > > > reserved.<BR> > > > - Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > > reserved.<BR> > > > - SPDX-License-Identifier: BSD-2-Clause-Patent > > > - > > > -**/ > > > - > > > -#include <Library/BaseLib.h> > > > - > > > -/** > > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > - > > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > - > > > -**/ > > > -VOID > > > -EFIAPI > > > -CpuFlushTlb ( > > > - VOID > > > - ) > > > -{ > > > - AsmWriteCr3 (AsmReadCr3 ()); > > > -} > > > diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > deleted file mode 100644 > > > index 8ddf7a2864..0000000000 > > > --- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > +++ /dev/null > > > @@ -1,32 +0,0 @@ > > > -;------------------------------------------------------------------ > > > ------------ ; -; Copyright (c) 2006, Intel Corporation. All rights > > > reserved.<BR> -; SPDX- > > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > > -; > > > -; CpuFlushTlb.Asm > > > -; > > > -; Abstract: > > > -; > > > -; CpuFlushTlb function > > > -; > > > -; Notes: > > > -; > > > -;------------------------------------------------------------------ > > > ------------ > > > - > > > - DEFAULT REL > > > - SECTION .text > > > - > > > -;------------------------------------------------------------------ > > > ------------ > > > -; VOID > > > -; EFIAPI > > > -; CpuFlushTlb ( > > > -; VOID > > > -; ); > > > -;------------------------------------------------------------------ > > > ------------ > > > -global ASM_PFX(CpuFlushTlb) > > > -ASM_PFX(CpuFlushTlb): > > > - mov rax, cr3 > > > - mov cr3, rax > > > - ret > > > - > > > -- > > > 2.31.1.windows.1 > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb 2022-12-09 2:40 ` Michael D Kinney 2022-12-09 7:24 ` Zhiguang Liu @ 2022-12-09 18:18 ` Michael D Kinney 2022-12-12 1:34 ` Zhiguang Liu 1 sibling, 1 reply; 5+ messages in thread From: Michael D Kinney @ 2022-12-09 18:18 UTC (permalink / raw) To: Liu, Zhiguang, devel@edk2.groups.io, Kinney, Michael D Cc: Gao, Liming, Ni, Ray Zhiguang, One additional comment. There are X86*.c files in BaseLib folder that have C implementation of functions that are common to IA32 and X64. Should BaseLib/IA32/CpuFlushTlbGcc.c be moved to BaseLib/X86CpuFlushTlb.c so it is not longer in an arch specific directory. It looks strange to have a file from IA32 directory in [Sources.X64] section. Thanks, Mike > -----Original Message----- > From: Kinney, Michael D <michael.d.kinney@intel.com> > Sent: Thursday, December 8, 2022 6:40 PM > To: Liu, Zhiguang <zhiguang.liu@intel.com>; devel@edk2.groups.io; Kinney, Michael D <michael.d.kinney@intel.com> > Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb > > Did you use git mv to rename CpuFlushTlbGcc,c to CpuFlushTlb.c > to preserve history? > > The log here shows a delete and new. > > Mike > > > -----Original Message----- > > From: Liu, Zhiguang <zhiguang.liu@intel.com> > > Sent: Thursday, December 8, 2022 5:42 PM > > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb > > > > Hi Liming and Mike, > > Could you help review this patch? > > > > Thanks > > Zhiguang > > > > > -----Original Message----- > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > Zhiguang Liu > > > Sent: Friday, December 2, 2022 2:25 PM > > > To: devel@edk2.groups.io > > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Kinney, Michael D > > > <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; > > > Ni, Ray <ray.ni@intel.com> > > > Subject: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for > > > CpuFlushTlb > > > > > > For different compilers, both IA32 and X64 can use Ia32/CpuFlushTlbGcc.c, > > > which is C code (no inline assembly code). > > > To simplify, remove other assemly file for CpuFlushTlb, and rename > > > Ia32/CpuFlushTlbGcc.c to Ia32/CpuFlushTlb.c. > > > > > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > > Signed-off-by: Ray Ni <ray.ni@intel.com> > > > Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > --- > > > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 10 ++---- > > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c | 12 +++---- > > > .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 31 ------------------ > > > .../Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c | 25 --------------- > > > .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 32 ------------------- > > > 5 files changed, 9 insertions(+), 101 deletions(-) delete mode 100644 > > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > delete mode 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > index 6b230f6e6d..0feb592638 100644 > > > --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > @@ -4,7 +4,7 @@ > > > # CPU Library implemented using ASM functions for IA32, X64, ARM, > > > AARCH64, # PAL CALLs for IPF, and empty functions for EBC. > > > # > > > -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> > > > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights > > > +reserved.<BR> > > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> # > > > Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR> # > > > Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights > > > reserved.<BR> @@ -31,16 +31,12 @@ > > > > > > [Sources.IA32] > > > Ia32/CpuSleep.c | MSFT > > > - Ia32/CpuFlushTlb.c | MSFT > > > - > > > Ia32/CpuSleep.nasm| INTEL > > > - Ia32/CpuFlushTlb.nasm| INTEL > > > - > > > Ia32/CpuSleepGcc.c | GCC > > > - Ia32/CpuFlushTlbGcc.c | GCC > > > + Ia32/CpuFlushTlb.c > > > > > > [Sources.X64] > > > - X64/CpuFlushTlb.nasm > > > + Ia32/CpuFlushTlb.c > > > X64/CpuSleep.nasm > > > > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > index 549f4eb8a0..17a351d054 100644 > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > +++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > @@ -1,11 +1,14 @@ > > > /** @file > > > - CpuFlushTlb function. > > > + CpuFlushTlb function for Ia32/X64. > > > > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> > > > + Copyright (c) 2006 - 2022, Intel Corporation. All rights > > > + reserved.<BR> Portions copyright (c) 2008 - 2009, Apple Inc. All > > > + rights reserved.<BR> > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > **/ > > > > > > +#include <Library/BaseLib.h> > > > + > > > /** > > > Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > > > > @@ -18,8 +21,5 @@ CpuFlushTlb ( > > > VOID > > > ) > > > { > > > - _asm { > > > - mov eax, cr3 > > > - mov cr3, eax > > > - } > > > + AsmWriteCr3 (AsmReadCr3 ()); > > > } > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > deleted file mode 100644 > > > index bc3b68e3f2..0000000000 > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > +++ /dev/null > > > @@ -1,31 +0,0 @@ > > > -;------------------------------------------------------------------------------ ; -; > > > Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> -; SPDX- > > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > > -; > > > -; CpuFlushTlb.Asm > > > -; > > > -; Abstract: > > > -; > > > -; CpuFlushTlb function > > > -; > > > -; Notes: > > > -; > > > -;------------------------------------------------------------------------------ > > > - > > > - SECTION .text > > > - > > > -;------------------------------------------------------------------------------ > > > -; VOID > > > -; EFIAPI > > > -; CpuFlushTlb ( > > > -; VOID > > > -; ); > > > -;------------------------------------------------------------------------------ > > > -global ASM_PFX(CpuFlushTlb) > > > -ASM_PFX(CpuFlushTlb): > > > - mov eax, cr3 > > > - mov cr3, eax ; moving to CR3 flushes TLB > > > - ret > > > - > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > deleted file mode 100644 > > > index ee44f2ea6e..0000000000 > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > +++ /dev/null > > > @@ -1,25 +0,0 @@ > > > -/** @file > > > - CpuFlushTlb function for Ia32/X64 GCC. > > > - > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> > > > - Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> > > > - SPDX-License-Identifier: BSD-2-Clause-Patent > > > - > > > -**/ > > > - > > > -#include <Library/BaseLib.h> > > > - > > > -/** > > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > - > > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > - > > > -**/ > > > -VOID > > > -EFIAPI > > > -CpuFlushTlb ( > > > - VOID > > > - ) > > > -{ > > > - AsmWriteCr3 (AsmReadCr3 ()); > > > -} > > > diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > deleted file mode 100644 > > > index 8ddf7a2864..0000000000 > > > --- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > +++ /dev/null > > > @@ -1,32 +0,0 @@ > > > -;------------------------------------------------------------------------------ ; -; > > > Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> -; SPDX- > > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > > -; > > > -; CpuFlushTlb.Asm > > > -; > > > -; Abstract: > > > -; > > > -; CpuFlushTlb function > > > -; > > > -; Notes: > > > -; > > > -;------------------------------------------------------------------------------ > > > - > > > - DEFAULT REL > > > - SECTION .text > > > - > > > -;------------------------------------------------------------------------------ > > > -; VOID > > > -; EFIAPI > > > -; CpuFlushTlb ( > > > -; VOID > > > -; ); > > > -;------------------------------------------------------------------------------ > > > -global ASM_PFX(CpuFlushTlb) > > > -ASM_PFX(CpuFlushTlb): > > > - mov rax, cr3 > > > - mov cr3, rax > > > - ret > > > - > > > -- > > > 2.31.1.windows.1 > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb 2022-12-09 18:18 ` Michael D Kinney @ 2022-12-12 1:34 ` Zhiguang Liu 0 siblings, 0 replies; 5+ messages in thread From: Zhiguang Liu @ 2022-12-12 1:34 UTC (permalink / raw) To: Kinney, Michael D, devel@edk2.groups.io; +Cc: Gao, Liming, Ni, Ray Hi Mike, Good comment. I will modify and send a new version. Thanks Zhiguang > -----Original Message----- > From: Kinney, Michael D <michael.d.kinney@intel.com> > Sent: Saturday, December 10, 2022 2:18 AM > To: Liu, Zhiguang <zhiguang.liu@intel.com>; devel@edk2.groups.io; Kinney, > Michael D <michael.d.kinney@intel.com> > Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly > for CpuFlushTlb > > Zhiguang, > > One additional comment. > > There are X86*.c files in BaseLib folder that have C implementation of > functions that are common to IA32 and X64. Should > BaseLib/IA32/CpuFlushTlbGcc.c be moved to BaseLib/X86CpuFlushTlb.c so it > is not longer in an arch specific directory. > > It looks strange to have a file from IA32 directory in [Sources.X64] section. > > Thanks, > > Mike > > > -----Original Message----- > > From: Kinney, Michael D <michael.d.kinney@intel.com> > > Sent: Thursday, December 8, 2022 6:40 PM > > To: Liu, Zhiguang <zhiguang.liu@intel.com>; devel@edk2.groups.io; > > Kinney, Michael D <michael.d.kinney@intel.com> > > Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly > > for CpuFlushTlb > > > > Did you use git mv to rename CpuFlushTlbGcc,c to CpuFlushTlb.c to > > preserve history? > > > > The log here shows a delete and new. > > > > Mike > > > > > -----Original Message----- > > > From: Liu, Zhiguang <zhiguang.liu@intel.com> > > > Sent: Thursday, December 8, 2022 5:42 PM > > > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com> > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming > > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > > > Subject: RE: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove > assembly > > > for CpuFlushTlb > > > > > > Hi Liming and Mike, > > > Could you help review this patch? > > > > > > Thanks > > > Zhiguang > > > > > > > -----Original Message----- > > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of > > > > Zhiguang Liu > > > > Sent: Friday, December 2, 2022 2:25 PM > > > > To: devel@edk2.groups.io > > > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Kinney, Michael D > > > > <michael.d.kinney@intel.com>; Gao, Liming > > > > <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> > > > > Subject: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly > > > > for CpuFlushTlb > > > > > > > > For different compilers, both IA32 and X64 can use > > > > Ia32/CpuFlushTlbGcc.c, which is C code (no inline assembly code). > > > > To simplify, remove other assemly file for CpuFlushTlb, and rename > > > > Ia32/CpuFlushTlbGcc.c to Ia32/CpuFlushTlb.c. > > > > > > > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > > > Signed-off-by: Ray Ni <ray.ni@intel.com> > > > > Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > > --- > > > > MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 10 ++---- > > > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c | 12 +++---- > > > > .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 31 ------------------ > > > > .../Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c | 25 --------------- > > > > .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 32 ------------------- > > > > 5 files changed, 9 insertions(+), 101 deletions(-) delete mode > > > > 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > > delete mode 100644 > > > > MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > > delete mode 100644 > MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > > b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > > index 6b230f6e6d..0feb592638 100644 > > > > --- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > > +++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf > > > > @@ -4,7 +4,7 @@ > > > > # CPU Library implemented using ASM functions for IA32, X64, > > > > ARM, AARCH64, # PAL CALLs for IPF, and empty functions for EBC. > > > > # > > > > -# Copyright (c) 2007 - 2018, Intel Corporation. All rights > > > > reserved.<BR> > > > > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights > > > > +reserved.<BR> > > > > # Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > > > reserved.<BR> # Portions copyright (c) 2011 - 2013, ARM Ltd. All > > > > rights reserved.<BR> # Copyright (c) 2020, Hewlett Packard > > > > Enterprise Development LP. All rights reserved.<BR> @@ -31,16 > > > > +31,12 @@ > > > > > > > > [Sources.IA32] > > > > Ia32/CpuSleep.c | MSFT > > > > - Ia32/CpuFlushTlb.c | MSFT > > > > - > > > > Ia32/CpuSleep.nasm| INTEL > > > > - Ia32/CpuFlushTlb.nasm| INTEL > > > > - > > > > Ia32/CpuSleepGcc.c | GCC > > > > - Ia32/CpuFlushTlbGcc.c | GCC > > > > + Ia32/CpuFlushTlb.c > > > > > > > > [Sources.X64] > > > > - X64/CpuFlushTlb.nasm > > > > + Ia32/CpuFlushTlb.c > > > > X64/CpuSleep.nasm > > > > > > > > > > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > > index 549f4eb8a0..17a351d054 100644 > > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > > +++ b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c > > > > @@ -1,11 +1,14 @@ > > > > /** @file > > > > - CpuFlushTlb function. > > > > + CpuFlushTlb function for Ia32/X64. > > > > > > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights > > > > reserved.<BR> > > > > + Copyright (c) 2006 - 2022, Intel Corporation. All rights > > > > + reserved.<BR> Portions copyright (c) 2008 - 2009, Apple Inc. > > > > + All rights reserved.<BR> > > > > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > > > > > **/ > > > > > > > > +#include <Library/BaseLib.h> > > > > + > > > > /** > > > > Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > > > > > > @@ -18,8 +21,5 @@ CpuFlushTlb ( > > > > VOID > > > > ) > > > > { > > > > - _asm { > > > > - mov eax, cr3 > > > > - mov cr3, eax > > > > - } > > > > + AsmWriteCr3 (AsmReadCr3 ()); > > > > } > > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > > deleted file mode 100644 > > > > index bc3b68e3f2..0000000000 > > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm > > > > +++ /dev/null > > > > @@ -1,31 +0,0 @@ > > > > -;---------------------------------------------------------------- > > > > -------------- ; -; Copyright (c) 2006, Intel Corporation. All > > > > rights reserved.<BR> -; SPDX- > > > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > > > -; > > > > -; CpuFlushTlb.Asm > > > > -; > > > > -; Abstract: > > > > -; > > > > -; CpuFlushTlb function > > > > -; > > > > -; Notes: > > > > -; > > > > -;---------------------------------------------------------------- > > > > -------------- > > > > - > > > > - SECTION .text > > > > - > > > > -;---------------------------------------------------------------- > > > > -------------- > > > > -; VOID > > > > -; EFIAPI > > > > -; CpuFlushTlb ( > > > > -; VOID > > > > -; ); > > > > -;---------------------------------------------------------------- > > > > -------------- > > > > -global ASM_PFX(CpuFlushTlb) > > > > -ASM_PFX(CpuFlushTlb): > > > > - mov eax, cr3 > > > > - mov cr3, eax ; moving to CR3 flushes TLB > > > > - ret > > > > - > > > > diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > > b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > > deleted file mode 100644 > > > > index ee44f2ea6e..0000000000 > > > > --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c > > > > +++ /dev/null > > > > @@ -1,25 +0,0 @@ > > > > -/** @file > > > > - CpuFlushTlb function for Ia32/X64 GCC. > > > > - > > > > - Copyright (c) 2006 - 2008, Intel Corporation. All rights > > > > reserved.<BR> > > > > - Portions copyright (c) 2008 - 2009, Apple Inc. All rights > > > > reserved.<BR> > > > > - SPDX-License-Identifier: BSD-2-Clause-Patent > > > > - > > > > -**/ > > > > - > > > > -#include <Library/BaseLib.h> > > > > - > > > > -/** > > > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > > - > > > > - Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. > > > > - > > > > -**/ > > > > -VOID > > > > -EFIAPI > > > > -CpuFlushTlb ( > > > > - VOID > > > > - ) > > > > -{ > > > > - AsmWriteCr3 (AsmReadCr3 ()); > > > > -} > > > > diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > deleted file mode 100644 > > > > index 8ddf7a2864..0000000000 > > > > --- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm > > > > +++ /dev/null > > > > @@ -1,32 +0,0 @@ > > > > -;---------------------------------------------------------------- > > > > -------------- ; -; Copyright (c) 2006, Intel Corporation. All > > > > rights reserved.<BR> -; SPDX- > > > > License-Identifier: BSD-2-Clause-Patent -; -; Module Name: > > > > -; > > > > -; CpuFlushTlb.Asm > > > > -; > > > > -; Abstract: > > > > -; > > > > -; CpuFlushTlb function > > > > -; > > > > -; Notes: > > > > -; > > > > -;---------------------------------------------------------------- > > > > -------------- > > > > - > > > > - DEFAULT REL > > > > - SECTION .text > > > > - > > > > -;---------------------------------------------------------------- > > > > -------------- > > > > -; VOID > > > > -; EFIAPI > > > > -; CpuFlushTlb ( > > > > -; VOID > > > > -; ); > > > > -;---------------------------------------------------------------- > > > > -------------- > > > > -global ASM_PFX(CpuFlushTlb) > > > > -ASM_PFX(CpuFlushTlb): > > > > - mov rax, cr3 > > > > - mov cr3, rax > > > > - ret > > > > - > > > > -- > > > > 2.31.1.windows.1 > > > > > > > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-12-12 1:34 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <172CE5E0BCC4376C.1705@groups.io> 2022-12-09 1:42 ` [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb Zhiguang Liu 2022-12-09 2:40 ` Michael D Kinney 2022-12-09 7:24 ` Zhiguang Liu 2022-12-09 18:18 ` Michael D Kinney 2022-12-12 1:34 ` Zhiguang Liu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox