]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb
authorLiu, Zhiguang <Zhiguang.Liu@intel.com>
Mon, 12 Dec 2022 07:30:22 +0000 (15:30 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 14 Dec 2022 13:34:33 +0000 (13:34 +0000)
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.

Reviewed-by: 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
MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c [deleted file]
MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm [deleted file]
MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c [deleted file]
MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm [deleted file]
MdePkg/Library/BaseCpuLib/X86CpuFlushTlb.c [new file with mode: 0644]

index 6b230f6e6d5d8f6422b080431d156fafe687f39d..5b18343c5971bdfdc3db5e86f58a3c5d1e4c1dbc 100644 (file)
@@ -4,7 +4,7 @@
 #  CPU Library implemented using ASM functions for IA32, X64, ARM, AARCH64,\r
 #  PAL CALLs for IPF, and empty functions for EBC.\r
 #\r
-#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.<BR>\r
 #  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 #  Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
 \r
 [Sources.IA32]\r
   Ia32/CpuSleep.c | MSFT\r
-  Ia32/CpuFlushTlb.c | MSFT\r
-\r
   Ia32/CpuSleep.nasm| INTEL\r
-  Ia32/CpuFlushTlb.nasm| INTEL\r
-\r
   Ia32/CpuSleepGcc.c | GCC\r
-  Ia32/CpuFlushTlbGcc.c | GCC\r
+  X86CpuFlushTlb.c\r
 \r
 [Sources.X64]\r
-  X64/CpuFlushTlb.nasm\r
+  X86CpuFlushTlb.c\r
   X64/CpuSleep.nasm\r
 \r
 \r
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.c
deleted file mode 100644 (file)
index 549f4eb..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file\r
-  CpuFlushTlb function.\r
-\r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-/**\r
-  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
-\r
-  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-CpuFlushTlb (\r
-  VOID\r
-  )\r
-{\r
-  _asm {\r
-    mov     eax, cr3\r
-    mov     cr3, eax\r
-  }\r
-}\r
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlb.nasm
deleted file mode 100644 (file)
index bc3b68e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
-; SPDX-License-Identifier: BSD-2-Clause-Patent\r
-;\r
-; Module Name:\r
-;\r
-;   CpuFlushTlb.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   CpuFlushTlb function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    SECTION .text\r
-\r
-;------------------------------------------------------------------------------\r
-; VOID\r
-; EFIAPI\r
-; CpuFlushTlb (\r
-;   VOID\r
-;   );\r
-;------------------------------------------------------------------------------\r
-global ASM_PFX(CpuFlushTlb)\r
-ASM_PFX(CpuFlushTlb):\r
-    mov     eax, cr3\r
-    mov     cr3, eax                    ; moving to CR3 flushes TLB\r
-    ret\r
-\r
diff --git a/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c b/MdePkg/Library/BaseCpuLib/Ia32/CpuFlushTlbGcc.c
deleted file mode 100644 (file)
index ee44f2e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/** @file\r
-  CpuFlushTlb function for Ia32/X64 GCC.\r
-\r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
-  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
-  SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-\r
-/**\r
-  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
-\r
-  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-CpuFlushTlb (\r
-  VOID\r
-  )\r
-{\r
-  AsmWriteCr3 (AsmReadCr3 ());\r
-}\r
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.nasm
deleted file mode 100644 (file)
index 8ddf7a2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-;------------------------------------------------------------------------------ ;\r
-; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
-; SPDX-License-Identifier: BSD-2-Clause-Patent\r
-;\r
-; Module Name:\r
-;\r
-;   CpuFlushTlb.Asm\r
-;\r
-; Abstract:\r
-;\r
-;   CpuFlushTlb function\r
-;\r
-; Notes:\r
-;\r
-;------------------------------------------------------------------------------\r
-\r
-    DEFAULT REL\r
-    SECTION .text\r
-\r
-;------------------------------------------------------------------------------\r
-; VOID\r
-; EFIAPI\r
-; CpuFlushTlb (\r
-;   VOID\r
-;   );\r
-;------------------------------------------------------------------------------\r
-global ASM_PFX(CpuFlushTlb)\r
-ASM_PFX(CpuFlushTlb):\r
-    mov     rax, cr3\r
-    mov     cr3, rax\r
-    ret\r
-\r
diff --git a/MdePkg/Library/BaseCpuLib/X86CpuFlushTlb.c b/MdePkg/Library/BaseCpuLib/X86CpuFlushTlb.c
new file mode 100644 (file)
index 0000000..17a351d
--- /dev/null
@@ -0,0 +1,25 @@
+/** @file\r
+  CpuFlushTlb function for Ia32/X64.\r
+\r
+  Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/BaseLib.h>\r
+\r
+/**\r
+  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
+\r
+  Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+CpuFlushTlb (\r
+  VOID\r
+  )\r
+{\r
+  AsmWriteCr3 (AsmReadCr3 ());\r
+}\r