Skip to content

Commit

Permalink
EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
Signed-off-by: Zhiguang Liu <[email protected]>
  • Loading branch information
LiuZhiguang001 authored and mergify[bot] committed Dec 8, 2022
1 parent 2c28402 commit 8a485e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions EmulatorPkg/Include/Ppi/EmuThunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions EmulatorPkg/Unix/Host/Host.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions EmulatorPkg/Win/Host/WinHost.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ Routine Description:
}

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);
Expand Down

0 comments on commit 8a485e4

Please sign in to comment.