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>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
Liu, Zhiguang 2022-12-06 13:41:36 +08:00 committed by mergify[bot]
parent 2c284027b2
commit 8a485e4bb8
3 changed files with 9 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -499,6 +499,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);