From nobody Thu May 2 02:23:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+96885+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96885+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1669962316; cv=none; d=zohomail.com; s=zohoarc; b=iWaEqQHveWEIaVlfRmgcaZ7FXI7Fi6M3F04tkXvkfEtBOJGNw2jmQZ6coTN7EuJesKEA3nqycHKSrDPy5ziESOzgvIbdUQNcpTv65kp9ct2Of5Y3qKyjR3xo1MZYB+6Cjzewilbx6tQA7SbCcFtKTduITD4EDeM4u2hiwH0dezc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669962316; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=4vqe1Hng9TA4xSKYKKXFOyZFUjIiRbXi8cEWHsp9yR0=; b=M5qJJDpsyHsUA8ayHqFPjLm6vlBYVqcLQDAR8UziCHBJ3fPaIH2V2eKz2GPG2IoFYl1QhS3M/LtXf0222SJz7Ya7bhiBhE2ltSKyO/3RpGvOCR4Lb2PQjAJOX0qnettqiwinXof3uEUCw9Cfzd5pWzx9hK7O2TDljsAyoL8jefM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+96885+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1669962316278442.5056423613495; Thu, 1 Dec 2022 22:25:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Jzy5YY1788612xFSXf3uPmP4; Thu, 01 Dec 2022 22:25:15 -0800 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.68805.1669962314921437954 for ; Thu, 01 Dec 2022 22:25:15 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="314584992" X-IronPort-AV: E=Sophos;i="5.96,210,1665471600"; d="scan'208";a="314584992" X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2022 22:25:14 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10548"; a="890035411" X-IronPort-AV: E=Sophos;i="5.96,210,1665471600"; d="scan'208";a="890035411" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2022 22:25:13 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Michael D Kinney , Liming Gao , Ray Ni Subject: [edk2-devel] [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb Date: Fri, 2 Dec 2022 14:25:01 +0800 Message-Id: <20221202062502.4429-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: IshRYhhHSTDPH4b7GVV2vSalx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1669962315; bh=u8ibAGnkTTRXHfLJOG6m/IaqnSl3+X/M8JArFhYvkz0=; h=Cc:Date:From:Reply-To:Subject:To; b=OMCG99fAdJ5ZAB2/7S4D0ZwCWY1OCgLmFWZZqMfW90Fsz4qnxxakdvpaJ6nnLqZH/RW xSNK4ZMxTSvGYQ5nFg2B9au28Uh7+K4f6yjWaK2weCGvfDO42Yv879No2oPcOg4WFAeWR CkWcALqCy3kXosLefWKUOA2+ZY84g6RLhnI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1669962317464100002 Content-Type: text/plain; charset="utf-8" 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 Cc: Liming Gao Signed-off-by: Ray Ni Signed-off-by: Zhiguang Liu --- 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/Base= CpuLib/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.
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
@@ -31,16 +31,12 @@ =20 [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 =20 [Sources.X64] - X64/CpuFlushTlb.nasm + Ia32/CpuFlushTlb.c X64/CpuSleep.nasm =20 =20 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. =20 - Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
+ Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 +#include + /** Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. =20 @@ -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/Libra= ry/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.
-; 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/Libra= ry/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.
- Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include - -/** - 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/Librar= y/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.
-; 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 - --=20 2.31.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#96885): https://edk2.groups.io/g/devel/message/96885 Mute This Topic: https://groups.io/mt/95401264/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-