public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb
@ 2022-12-02  6:25 Zhiguang Liu
  2022-12-02  6:25 ` [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation Zhiguang Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Zhiguang Liu @ 2022-12-02  6:25 UTC (permalink / raw)
  To: devel; +Cc: Zhiguang Liu, Michael D Kinney, Liming Gao, Ray Ni

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 related	[flat|nested] 7+ messages in thread

* [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation
  2022-12-02  6:25 [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb Zhiguang Liu
@ 2022-12-02  6:25 ` Zhiguang Liu
  2022-12-02  9:47   ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 7+ messages in thread
From: Zhiguang Liu @ 2022-12-02  6:25 UTC (permalink / raw)
  To: devel; +Cc: Zhiguang Liu, Michael D Kinney, Liming Gao, Ray Ni

Remove HOST_APPLICATION limitation for UnitTestHostBaseLib, so that
this library can be used as BaseLib by Emulator.
Also, add some missing files

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>
---
 MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
index 09a610c31c..fefa2e79f6 100644
--- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
+++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Base Library implementation for use with host based unit tests.
 #
-#  Copyright (c) 2007 - 2021, 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>
@@ -18,7 +18,7 @@
   FILE_GUID                      = 9555A0D3-09BA-46C4-A51A-45198E3C765E
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.1
-  LIBRARY_CLASS                  = BaseLib|HOST_APPLICATION
+  LIBRARY_CLASS                  = BaseLib
   LIBRARY_CLASS                  = UnitTestHostBaseLib|HOST_APPLICATION
 
 #
@@ -128,6 +128,7 @@
   X86RdRand.c
   X86SpeculationBarrier.c
   X86UnitTestHost.c
+  IntelTdxNull.c
 
 [Sources.X64]
   X64/LongJump.nasm
@@ -168,6 +169,7 @@
   X64/RdRand.nasm
   ChkStkGcc.c  | GCC
   X86UnitTestHost.c
+  IntelTdxNull.c
 
 [Sources.EBC]
   Ebc/CpuBreakpoint.c
-- 
2.31.1.windows.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation
  2022-12-02  6:25 ` [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation Zhiguang Liu
@ 2022-12-02  9:47   ` gaoliming
  2022-12-05  5:37     ` Ni, Ray
  0 siblings, 1 reply; 7+ messages in thread
From: gaoliming @ 2022-12-02  9:47 UTC (permalink / raw)
  To: devel, zhiguang.liu; +Cc: 'Michael D Kinney', 'Ray Ni'

Zhiguang:
  Can you explain more about the emulator usage model for this library?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhiguang Liu
> 发送时间: 2022年12月2日 14:25
> 收件人: devel@edk2.groups.io
> 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Michael D Kinney
> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Ray Ni <ray.ni@intel.com>
> 主题: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> HOST_APPLICATION limitation
> 
> Remove HOST_APPLICATION limitation for UnitTestHostBaseLib, so that
> this library can be used as BaseLib by Emulator.
> Also, add some missing files
> 
> 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>
> ---
>  MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> index 09a610c31c..fefa2e79f6 100644
> --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  Base Library implementation for use with host based unit tests.
>  #
> -#  Copyright (c) 2007 - 2021, 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>
> @@ -18,7 +18,7 @@
>    FILE_GUID                      =
> 9555A0D3-09BA-46C4-A51A-45198E3C765E
>    MODULE_TYPE                    = BASE
>    VERSION_STRING                 = 1.1
> -  LIBRARY_CLASS                  = BaseLib|HOST_APPLICATION
> +  LIBRARY_CLASS                  = BaseLib
>    LIBRARY_CLASS                  =
> UnitTestHostBaseLib|HOST_APPLICATION
> 
>  #
> @@ -128,6 +128,7 @@
>    X86RdRand.c
>    X86SpeculationBarrier.c
>    X86UnitTestHost.c
> +  IntelTdxNull.c
> 
>  [Sources.X64]
>    X64/LongJump.nasm
> @@ -168,6 +169,7 @@
>    X64/RdRand.nasm
>    ChkStkGcc.c  | GCC
>    X86UnitTestHost.c
> +  IntelTdxNull.c
> 
>  [Sources.EBC]
>    Ebc/CpuBreakpoint.c
> --
> 2.31.1.windows.1
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation
  2022-12-02  9:47   ` 回复: [edk2-devel] " gaoliming
@ 2022-12-05  5:37     ` Ni, Ray
  2022-12-05  5:53       ` Zhiguang Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Ni, Ray @ 2022-12-05  5:37 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, Liu, Zhiguang; +Cc: Kinney, Michael D

Liming,
We are running some code that requires MSR access (e.g.: MtrrLib) in EmulatorPkg.

Thanks,
Ray

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming via groups.io
> Sent: Friday, December 2, 2022 5:48 PM
> To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Ni, Ray
> <ray.ni@intel.com>
> Subject: 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> HOST_APPLICATION limitation
> 
> Zhiguang:
>   Can you explain more about the emulator usage model for this library?
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhiguang Liu
> > 发送时间: 2022年12月2日 14:25
> > 收件人: devel@edk2.groups.io
> > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Michael D Kinney
> > <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> > Ray Ni <ray.ni@intel.com>
> > 主题: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> > HOST_APPLICATION limitation
> >
> > Remove HOST_APPLICATION limitation for UnitTestHostBaseLib, so that
> > this library can be used as BaseLib by Emulator.
> > Also, add some missing files
> >
> > 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>
> > ---
> >  MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > index 09a610c31c..fefa2e79f6 100644
> > --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > @@ -1,7 +1,7 @@
> >  ## @file
> >  #  Base Library implementation for use with host based unit tests.
> >  #
> > -#  Copyright (c) 2007 - 2021, 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>
> > @@ -18,7 +18,7 @@
> >    FILE_GUID                      =
> > 9555A0D3-09BA-46C4-A51A-45198E3C765E
> >    MODULE_TYPE                    = BASE
> >    VERSION_STRING                 = 1.1
> > -  LIBRARY_CLASS                  = BaseLib|HOST_APPLICATION
> > +  LIBRARY_CLASS                  = BaseLib
> >    LIBRARY_CLASS                  =
> > UnitTestHostBaseLib|HOST_APPLICATION
> >
> >  #
> > @@ -128,6 +128,7 @@
> >    X86RdRand.c
> >    X86SpeculationBarrier.c
> >    X86UnitTestHost.c
> > +  IntelTdxNull.c
> >
> >  [Sources.X64]
> >    X64/LongJump.nasm
> > @@ -168,6 +169,7 @@
> >    X64/RdRand.nasm
> >    ChkStkGcc.c  | GCC
> >    X86UnitTestHost.c
> > +  IntelTdxNull.c
> >
> >  [Sources.EBC]
> >    Ebc/CpuBreakpoint.c
> > --
> > 2.31.1.windows.1
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation
  2022-12-05  5:37     ` Ni, Ray
@ 2022-12-05  5:53       ` Zhiguang Liu
  2022-12-07  1:02         ` 回复: " gaoliming
  0 siblings, 1 reply; 7+ messages in thread
From: Zhiguang Liu @ 2022-12-05  5:53 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io, Gao, Liming; +Cc: Kinney, Michael D

Hi Liming,
Like ray said, we are trying to use some baselib function in EmulatorPkg, which is assembly code in normal BaseLib, and is mocked in UnitTestBaseLib, such as AsmWriteMsr64 and AsmCpuid.

Thanks
Zhiguang

> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Monday, December 5, 2022 1:38 PM
> To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Liu,
> Zhiguang <zhiguang.liu@intel.com>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> Subject: RE: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> HOST_APPLICATION limitation
> 
> Liming,
> We are running some code that requires MSR access (e.g.: MtrrLib) in
> EmulatorPkg.
> 
> Thanks,
> Ray
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > gaoliming via groups.io
> > Sent: Friday, December 2, 2022 5:48 PM
> > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>
> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Ni, Ray
> > <ray.ni@intel.com>
> > Subject: 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib:
> Remove
> > HOST_APPLICATION limitation
> >
> > Zhiguang:
> >   Can you explain more about the emulator usage model for this library?
> >
> > Thanks
> > Liming
> > > -----邮件原件-----
> > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhiguang
> Liu
> > > 发送时间: 2022年12月2日 14:25
> > > 收件人: devel@edk2.groups.io
> > > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Michael D Kinney
> > > <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>;
> > > Ray Ni <ray.ni@intel.com>
> > > 主题: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> > > HOST_APPLICATION limitation
> > >
> > > Remove HOST_APPLICATION limitation for UnitTestHostBaseLib, so that
> > > this library can be used as BaseLib by Emulator.
> > > Also, add some missing files
> > >
> > > 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>
> > > ---
> > >  MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > index 09a610c31c..fefa2e79f6 100644
> > > --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > @@ -1,7 +1,7 @@
> > >  ## @file
> > >  #  Base Library implementation for use with host based unit tests.
> > >  #
> > > -#  Copyright (c) 2007 - 2021, 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> @@ -18,7 +18,7 @@
> > >    FILE_GUID                      =
> > > 9555A0D3-09BA-46C4-A51A-45198E3C765E
> > >    MODULE_TYPE                    = BASE
> > >    VERSION_STRING                 = 1.1
> > > -  LIBRARY_CLASS                  = BaseLib|HOST_APPLICATION
> > > +  LIBRARY_CLASS                  = BaseLib
> > >    LIBRARY_CLASS                  =
> > > UnitTestHostBaseLib|HOST_APPLICATION
> > >
> > >  #
> > > @@ -128,6 +128,7 @@
> > >    X86RdRand.c
> > >    X86SpeculationBarrier.c
> > >    X86UnitTestHost.c
> > > +  IntelTdxNull.c
> > >
> > >  [Sources.X64]
> > >    X64/LongJump.nasm
> > > @@ -168,6 +169,7 @@
> > >    X64/RdRand.nasm
> > >    ChkStkGcc.c  | GCC
> > >    X86UnitTestHost.c
> > > +  IntelTdxNull.c
> > >
> > >  [Sources.EBC]
> > >    Ebc/CpuBreakpoint.c
> > > --
> > > 2.31.1.windows.1
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> > 
> >


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation
  2022-12-05  5:53       ` Zhiguang Liu
@ 2022-12-07  1:02         ` gaoliming
  2022-12-07  1:21           ` Zhiguang Liu
  0 siblings, 1 reply; 7+ messages in thread
From: gaoliming @ 2022-12-07  1:02 UTC (permalink / raw)
  To: devel, zhiguang.liu, 'Ni, Ray'; +Cc: 'Kinney, Michael D'

Zhiguang and Ray:
  Thanks for your sharing. It is OK to use UnitTestHostBaseLib in emulator platform. 
  Please also update the file header in module inf to describe this usage.

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhiguang Liu
> 发送时间: 2022年12月5日 13:53
> 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Gao, Liming
> <gaoliming@byosoft.com.cn>
> 抄送: Kinney, Michael D <michael.d.kinney@intel.com>
> 主题: Re: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> HOST_APPLICATION limitation
> 
> Hi Liming,
> Like ray said, we are trying to use some baselib function in EmulatorPkg,
> which is assembly code in normal BaseLib, and is mocked in UnitTestBaseLib,
> such as AsmWriteMsr64 and AsmCpuid.
> 
> Thanks
> Zhiguang
> 
> > -----Original Message-----
> > From: Ni, Ray <ray.ni@intel.com>
> > Sent: Monday, December 5, 2022 1:38 PM
> > To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>; Liu,
> > Zhiguang <zhiguang.liu@intel.com>
> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> > Subject: RE: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> > HOST_APPLICATION limitation
> >
> > Liming,
> > We are running some code that requires MSR access (e.g.: MtrrLib) in
> > EmulatorPkg.
> >
> > Thanks,
> > Ray
> >
> > > -----Original Message-----
> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > > gaoliming via groups.io
> > > Sent: Friday, December 2, 2022 5:48 PM
> > > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>
> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Ni, Ray
> > > <ray.ni@intel.com>
> > > Subject: 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib:
> > Remove
> > > HOST_APPLICATION limitation
> > >
> > > Zhiguang:
> > >   Can you explain more about the emulator usage model for this library?
> > >
> > > Thanks
> > > Liming
> > > > -----邮件原件-----
> > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表
> Zhiguang
> > Liu
> > > > 发送时间: 2022年12月2日 14:25
> > > > 收件人: devel@edk2.groups.io
> > > > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Michael D Kinney
> > > > <michael.d.kinney@intel.com>; Liming Gao
> > <gaoliming@byosoft.com.cn>;
> > > > Ray Ni <ray.ni@intel.com>
> > > > 主题: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> > > > HOST_APPLICATION limitation
> > > >
> > > > Remove HOST_APPLICATION limitation for UnitTestHostBaseLib, so that
> > > > this library can be used as BaseLib by Emulator.
> > > > Also, add some missing files
> > > >
> > > > 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>
> > > > ---
> > > >  MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf | 6 ++++--
> > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > index 09a610c31c..fefa2e79f6 100644
> > > > --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > @@ -1,7 +1,7 @@
> > > >  ## @file
> > > >  #  Base Library implementation for use with host based unit tests.
> > > >  #
> > > > -#  Copyright (c) 2007 - 2021, 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> @@ -18,7 +18,7 @@
> > > >    FILE_GUID                      =
> > > > 9555A0D3-09BA-46C4-A51A-45198E3C765E
> > > >    MODULE_TYPE                    = BASE
> > > >    VERSION_STRING                 = 1.1
> > > > -  LIBRARY_CLASS                  =
> BaseLib|HOST_APPLICATION
> > > > +  LIBRARY_CLASS                  = BaseLib
> > > >    LIBRARY_CLASS                  =
> > > > UnitTestHostBaseLib|HOST_APPLICATION
> > > >
> > > >  #
> > > > @@ -128,6 +128,7 @@
> > > >    X86RdRand.c
> > > >    X86SpeculationBarrier.c
> > > >    X86UnitTestHost.c
> > > > +  IntelTdxNull.c
> > > >
> > > >  [Sources.X64]
> > > >    X64/LongJump.nasm
> > > > @@ -168,6 +169,7 @@
> > > >    X64/RdRand.nasm
> > > >    ChkStkGcc.c  | GCC
> > > >    X86UnitTestHost.c
> > > > +  IntelTdxNull.c
> > > >
> > > >  [Sources.EBC]
> > > >    Ebc/CpuBreakpoint.c
> > > > --
> > > > 2.31.1.windows.1
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation
  2022-12-07  1:02         ` 回复: " gaoliming
@ 2022-12-07  1:21           ` Zhiguang Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Zhiguang Liu @ 2022-12-07  1:21 UTC (permalink / raw)
  To: devel@edk2.groups.io, Gao, Liming, Ni, Ray; +Cc: Kinney, Michael D

Hi Liming,
Sure, I will update the patch

Thanks
Zhiguang

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> gaoliming via groups.io
> Sent: Wednesday, December 7, 2022 9:02 AM
> To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>; Ni, Ray
> <ray.ni@intel.com>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> Subject: 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> HOST_APPLICATION limitation
> 
> Zhiguang and Ray:
>   Thanks for your sharing. It is OK to use UnitTestHostBaseLib in emulator
> platform.
>   Please also update the file header in module inf to describe this usage.
> 
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Zhiguang Liu
> > 发送时间: 2022年12月5日 13:53
> > 收件人: Ni, Ray <ray.ni@intel.com>; devel@edk2.groups.io; Gao, Liming
> > <gaoliming@byosoft.com.cn>
> > 抄送: Kinney, Michael D <michael.d.kinney@intel.com>
> > 主题: Re: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> > HOST_APPLICATION limitation
> >
> > Hi Liming,
> > Like ray said, we are trying to use some baselib function in
> > EmulatorPkg, which is assembly code in normal BaseLib, and is mocked
> > in UnitTestBaseLib, such as AsmWriteMsr64 and AsmCpuid.
> >
> > Thanks
> > Zhiguang
> >
> > > -----Original Message-----
> > > From: Ni, Ray <ray.ni@intel.com>
> > > Sent: Monday, December 5, 2022 1:38 PM
> > > To: devel@edk2.groups.io; Gao, Liming <gaoliming@byosoft.com.cn>;
> > > Liu, Zhiguang <zhiguang.liu@intel.com>
> > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> > > Subject: RE: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib:
> Remove
> > > HOST_APPLICATION limitation
> > >
> > > Liming,
> > > We are running some code that requires MSR access (e.g.: MtrrLib) in
> > > EmulatorPkg.
> > >
> > > Thanks,
> > > Ray
> > >
> > > > -----Original Message-----
> > > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> > > > gaoliming via groups.io
> > > > Sent: Friday, December 2, 2022 5:48 PM
> > > > To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>
> > > > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Ni, Ray
> > > > <ray.ni@intel.com>
> > > > Subject: 回复: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib:
> > > Remove
> > > > HOST_APPLICATION limitation
> > > >
> > > > Zhiguang:
> > > >   Can you explain more about the emulator usage model for this library?
> > > >
> > > > Thanks
> > > > Liming
> > > > > -----邮件原件-----
> > > > > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表
> > Zhiguang
> > > Liu
> > > > > 发送时间: 2022年12月2日 14:25
> > > > > 收件人: devel@edk2.groups.io
> > > > > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Michael D Kinney
> > > > > <michael.d.kinney@intel.com>; Liming Gao
> > > <gaoliming@byosoft.com.cn>;
> > > > > Ray Ni <ray.ni@intel.com>
> > > > > 主题: [edk2-devel] [PATCH] MdePkg/UnitTestHostBaseLib: Remove
> > > > > HOST_APPLICATION limitation
> > > > >
> > > > > Remove HOST_APPLICATION limitation for UnitTestHostBaseLib, so
> > > > > that this library can be used as BaseLib by Emulator.
> > > > > Also, add some missing files
> > > > >
> > > > > 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>
> > > > > ---
> > > > >  MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf | 6 ++++--
> > > > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > > b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > > index 09a610c31c..fefa2e79f6 100644
> > > > > --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > > +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
> > > > > @@ -1,7 +1,7 @@
> > > > >  ## @file
> > > > >  #  Base Library implementation for use with host based unit tests.
> > > > >  #
> > > > > -#  Copyright (c) 2007 - 2021, 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> @@ -18,7 +18,7 @@
> > > > >    FILE_GUID                      =
> > > > > 9555A0D3-09BA-46C4-A51A-45198E3C765E
> > > > >    MODULE_TYPE                    = BASE
> > > > >    VERSION_STRING                 = 1.1
> > > > > -  LIBRARY_CLASS                  =
> > BaseLib|HOST_APPLICATION
> > > > > +  LIBRARY_CLASS                  = BaseLib
> > > > >    LIBRARY_CLASS                  =
> > > > > UnitTestHostBaseLib|HOST_APPLICATION
> > > > >
> > > > >  #
> > > > > @@ -128,6 +128,7 @@
> > > > >    X86RdRand.c
> > > > >    X86SpeculationBarrier.c
> > > > >    X86UnitTestHost.c
> > > > > +  IntelTdxNull.c
> > > > >
> > > > >  [Sources.X64]
> > > > >    X64/LongJump.nasm
> > > > > @@ -168,6 +169,7 @@
> > > > >    X64/RdRand.nasm
> > > > >    ChkStkGcc.c  | GCC
> > > > >    X86UnitTestHost.c
> > > > > +  IntelTdxNull.c
> > > > >
> > > > >  [Sources.EBC]
> > > > >    Ebc/CpuBreakpoint.c
> > > > > --
> > > > > 2.31.1.windows.1
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-07  1:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02  6:25 [PATCH] MdePkg/BaseCpuLib: Remove assembly for CpuFlushTlb Zhiguang Liu
2022-12-02  6:25 ` [PATCH] MdePkg/UnitTestHostBaseLib: Remove HOST_APPLICATION limitation Zhiguang Liu
2022-12-02  9:47   ` 回复: [edk2-devel] " gaoliming
2022-12-05  5:37     ` Ni, Ray
2022-12-05  5:53       ` Zhiguang Liu
2022-12-07  1:02         ` 回复: " gaoliming
2022-12-07  1:21           ` Zhiguang Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox