From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Liu, Zhiguang" <zhiguang.liu@intel.com>,
"devel@edk2.groups.io" <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: [PATCH v2] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb
Date: Tue, 13 Dec 2022 23:53:04 +0000 [thread overview]
Message-ID: <CO1PR11MB4929F3062DF8F3A798CFF1B2D2E39@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221212073022.232-1-zhiguang.liu@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Mike
> -----Original Message-----
> From: Liu, Zhiguang <zhiguang.liu@intel.com>
> Sent: Sunday, December 11, 2022 11:30 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: [PATCH v2] 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 X86CpuFlushTlb.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 | 25 ---------------
> .../Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm | 31 ------------------
> .../Library/BaseCpuLib/X64/CpuFlushTlb.nasm | 32 -------------------
> .../CpuFlushTlbGcc.c => X86CpuFlushTlb.c} | 4 +--
> 5 files changed, 5 insertions(+), 97 deletions(-)
> delete mode 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
> delete mode 100644 MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm
> delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm
> rename MdePkg/Library/BaseCpuLib/{Ia32/CpuFlushTlbGcc.c => X86CpuFlushTlb.c} (75%)
>
> diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> index 6b230f6e6d..5b18343c59 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
> + X86CpuFlushTlb.c
>
> [Sources.X64]
> - X64/CpuFlushTlb.nasm
> + X86CpuFlushTlb.c
> X64/CpuSleep.nasm
>
>
> diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
> deleted file mode 100644
> index 549f4eb8a0..0000000000
> --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -/** @file
> - CpuFlushTlb function.
> -
> - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
> - SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> -**/
> -
> -/**
> - 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
> - )
> -{
> - _asm {
> - mov eax, cr3
> - mov cr3, eax
> - }
> -}
> 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/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
> -
> diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c b/MdePkg/Library/BaseCpuLib/X86CpuFlushTlb.c
> similarity index 75%
> rename from MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c
> rename to MdePkg/Library/BaseCpuLib/X86CpuFlushTlb.c
> index ee44f2ea6e..17a351d054 100644
> --- a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c
> +++ b/MdePkg/Library/BaseCpuLib/X86CpuFlushTlb.c
> @@ -1,7 +1,7 @@
> /** @file
> - CpuFlushTlb function for Ia32/X64 GCC.
> + 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
>
> --
> 2.31.1.windows.1
prev parent reply other threads:[~2022-12-13 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 7:30 [PATCH v2] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb Zhiguang Liu
2022-12-13 23:53 ` Michael D Kinney [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CO1PR11MB4929F3062DF8F3A798CFF1B2D2E39@CO1PR11MB4929.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox