public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi
@ 2022-12-06  5:41 Zhiguang Liu
  2022-12-06  9:24 ` Ni, Ray
  0 siblings, 1 reply; 2+ messages in thread
From: Zhiguang Liu @ 2022-12-06  5:41 UTC (permalink / raw)
  To: devel; +Cc: Zhiguang Liu, Andrew Fish, Ray Ni

Record Argc, Argv and Envp in EmuThunk Ppi so that other modules
can use these fields to change behavior depends on boot parameters
or environment.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 EmulatorPkg/Include/Ppi/EmuThunk.h | 3 +++
 EmulatorPkg/Unix/Host/Host.c       | 3 +++
 EmulatorPkg/Win/Host/WinHost.c     | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h b/EmulatorPkg/Include/Ppi/EmuThunk.h
index cf29cf824c..c78ad692ed 100644
--- a/EmulatorPkg/Include/Ppi/EmuThunk.h
+++ b/EmulatorPkg/Include/Ppi/EmuThunk.h
@@ -107,6 +107,9 @@ typedef struct {
   EMU_PEI_AUTOSCAN           MemoryAutoScan;
   EMU_PEI_FD_INFORMATION     FirmwareDevices;
   EMU_PEI_THUNK_INTERFACE    Thunk;
+  INTN                       Argc;
+  CHAR8                      **Argv;
+  CHAR8                      **Envp;
   UINTN                      PersistentMemorySize;
   UINT8                      PersistentMemory[0];
 } EMU_THUNK_PPI;
diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index 8d0be5b54b..1f29dd00a3 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -145,6 +145,9 @@ main (
   }
 
   CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof (EMU_THUNK_PPI));
+  SecEmuThunkPpi->Argc                 = Argc;
+  SecEmuThunkPpi->Argv                 = Argv;
+  SecEmuThunkPpi->Envp                 = Envp;
   SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32 (PcdPersistentMemorySize);
   AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, SecEmuThunkPpi);
 
diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c
index 3b2fde297d..f639ba3b1b 100644
--- a/EmulatorPkg/Win/Host/WinHost.c
+++ b/EmulatorPkg/Win/Host/WinHost.c
@@ -485,6 +485,9 @@ Returns:
   }
 
   CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof (EMU_THUNK_PPI));
+  SecEmuThunkPpi->Argc                 = Argc;
+  SecEmuThunkPpi->Argv                 = Argv;
+  SecEmuThunkPpi->Envp                 = Envp;
   SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32 (PcdPersistentMemorySize);
   AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, SecEmuThunkPpi);
   AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiPeiReset2PpiGuid, &mEmuReset2Ppi);
-- 
2.31.1.windows.1


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

* Re: [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi
  2022-12-06  5:41 [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi Zhiguang Liu
@ 2022-12-06  9:24 ` Ni, Ray
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2022-12-06  9:24 UTC (permalink / raw)
  To: Liu, Zhiguang, devel@edk2.groups.io; +Cc: Andrew Fish

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Liu, Zhiguang <zhiguang.liu@intel.com>
> Sent: Tuesday, December 6, 2022 1:42 PM
> To: devel@edk2.groups.io
> Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Andrew Fish <afish@apple.com>;
> Ni, Ray <ray.ni@intel.com>
> Subject: [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk
> Ppi
> 
> Record Argc, Argv and Envp in EmuThunk Ppi so that other modules
> can use these fields to change behavior depends on boot parameters
> or environment.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  EmulatorPkg/Include/Ppi/EmuThunk.h | 3 +++
>  EmulatorPkg/Unix/Host/Host.c       | 3 +++
>  EmulatorPkg/Win/Host/WinHost.c     | 3 +++
>  3 files changed, 9 insertions(+)
> 
> diff --git a/EmulatorPkg/Include/Ppi/EmuThunk.h
> b/EmulatorPkg/Include/Ppi/EmuThunk.h
> index cf29cf824c..c78ad692ed 100644
> --- a/EmulatorPkg/Include/Ppi/EmuThunk.h
> +++ b/EmulatorPkg/Include/Ppi/EmuThunk.h
> @@ -107,6 +107,9 @@ typedef struct {
>    EMU_PEI_AUTOSCAN           MemoryAutoScan;
>    EMU_PEI_FD_INFORMATION     FirmwareDevices;
>    EMU_PEI_THUNK_INTERFACE    Thunk;
> +  INTN                       Argc;
> +  CHAR8                      **Argv;
> +  CHAR8                      **Envp;
>    UINTN                      PersistentMemorySize;
>    UINT8                      PersistentMemory[0];
>  } EMU_THUNK_PPI;
> diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
> index 8d0be5b54b..1f29dd00a3 100644
> --- a/EmulatorPkg/Unix/Host/Host.c
> +++ b/EmulatorPkg/Unix/Host/Host.c
> @@ -145,6 +145,9 @@ main (
>    }
> 
>    CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof
> (EMU_THUNK_PPI));
> +  SecEmuThunkPpi->Argc                 = Argc;
> +  SecEmuThunkPpi->Argv                 = Argv;
> +  SecEmuThunkPpi->Envp                 = Envp;
>    SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32
> (PcdPersistentMemorySize);
>    AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
> SecEmuThunkPpi);
> 
> diff --git a/EmulatorPkg/Win/Host/WinHost.c
> b/EmulatorPkg/Win/Host/WinHost.c
> index 3b2fde297d..f639ba3b1b 100644
> --- a/EmulatorPkg/Win/Host/WinHost.c
> +++ b/EmulatorPkg/Win/Host/WinHost.c
> @@ -485,6 +485,9 @@ Returns:
>    }
> 
>    CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof
> (EMU_THUNK_PPI));
> +  SecEmuThunkPpi->Argc                 = Argc;
> +  SecEmuThunkPpi->Argv                 = Argv;
> +  SecEmuThunkPpi->Envp                 = Envp;
>    SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32
> (PcdPersistentMemorySize);
>    AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid,
> SecEmuThunkPpi);
>    AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEfiPeiReset2PpiGuid,
> &mEmuReset2Ppi);
> --
> 2.31.1.windows.1


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

end of thread, other threads:[~2022-12-06  9:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-06  5:41 [PATCH 2/2] EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi Zhiguang Liu
2022-12-06  9:24 ` Ni, Ray

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