summaryrefslogtreecommitdiff
path: root/EmulatorPkg/Unix
diff options
context:
space:
mode:
authorLiu, Zhiguang <Zhiguang.Liu@intel.com>2022-12-06 13:40:52 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-12-08 10:44:20 +0000
commit22f73b6d2d3dfb70a13a184a2d0d26ed650e6ab9 (patch)
treef0bbf76eb133fbde1b07187f0d68f2bf71c64e87 /EmulatorPkg/Unix
parent1c75bf3c21da79b1bc1d50cfc593b57f73f2c560 (diff)
downloadedk2-22f73b6d2d3dfb70a13a184a2d0d26ed650e6ab9.zip
edk2-22f73b6d2d3dfb70a13a184a2d0d26ed650e6ab9.tar.gz
edk2-22f73b6d2d3dfb70a13a184a2d0d26ed650e6ab9.tar.bz2
EmulatorPkg: Add persistent memory in EmuThunkPpi
The persistent memory is for PEIM to use, and won't lose during cold or warm reset. PcdPersistentMemorySize is only used by WinHost.c, other modules can check the persistent memory size using the field PersistentMemorySize. Cc: Andrew Fish <afish@apple.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Diffstat (limited to 'EmulatorPkg/Unix')
-rw-r--r--EmulatorPkg/Unix/Host/Host.c13
-rw-r--r--EmulatorPkg/Unix/Host/Host.inf3
2 files changed, 13 insertions, 3 deletions
diff --git a/EmulatorPkg/Unix/Host/Host.c b/EmulatorPkg/Unix/Host/Host.c
index 38c01c8..8d0be5b 100644
--- a/EmulatorPkg/Unix/Host/Host.c
+++ b/EmulatorPkg/Unix/Host/Host.c
@@ -1,6 +1,6 @@
/*++ @file
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -102,6 +102,7 @@ main (
CHAR16 *FirmwareVolumesStr;
UINTN *StackPointer;
FILE *GdbTempFile;
+ EMU_THUNK_PPI *SecEmuThunkPpi;
//
// Xcode does not support sourcing gdb scripts directly, so the Xcode XML
@@ -137,7 +138,15 @@ main (
//
// PPIs pased into PEI_CORE
//
- AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, &mSecEmuThunkPpi);
+ SecEmuThunkPpi = AllocateZeroPool (sizeof (EMU_THUNK_PPI) + FixedPcdGet32 (PcdPersistentMemorySize));
+ if (SecEmuThunkPpi == NULL) {
+ printf ("ERROR : Can not allocate memory for SecEmuThunkPpi. Exiting.\n");
+ exit (1);
+ }
+
+ CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof (EMU_THUNK_PPI));
+ SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32 (PcdPersistentMemorySize);
+ AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, SecEmuThunkPpi);
SecInitThunkProtocol ();
diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
index c479d2b..f5ebbed 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -2,7 +2,7 @@
# Entry Point of Emu Emulator
#
# Main executable file of Unix Emulator that loads PEI core after initialization finished.
-# Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2022, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -106,6 +106,7 @@
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
+ gEmulatorPkgTokenSpaceGuid.PcdPersistentMemorySize
[FeaturePcd]
gEmulatorPkgTokenSpaceGuid.PcdEmulatorLazyLoadSymbols