]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/Unix/Host/Host.c
EmulatorPkg: Add persistent memory in EmuThunkPpi
[mirror_edk2.git] / EmulatorPkg / Unix / Host / Host.c
index 38c01c84af44d07484a48cdff58a19ed08f9ce01..8d0be5b54be042540efe1e6216c1f8fa38fb1fde 100644 (file)
@@ -1,6 +1,6 @@
 /*++ @file\r
 \r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>\r
 SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -102,6 +102,7 @@ main (
   CHAR16                *FirmwareVolumesStr;\r
   UINTN                 *StackPointer;\r
   FILE                  *GdbTempFile;\r
+  EMU_THUNK_PPI         *SecEmuThunkPpi;\r
 \r
   //\r
   // Xcode does not support sourcing gdb scripts directly, so the Xcode XML\r
@@ -137,7 +138,15 @@ main (
   //\r
   // PPIs pased into PEI_CORE\r
   //\r
-  AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, &mSecEmuThunkPpi);\r
+  SecEmuThunkPpi = AllocateZeroPool (sizeof (EMU_THUNK_PPI) + FixedPcdGet32 (PcdPersistentMemorySize));\r
+  if (SecEmuThunkPpi == NULL) {\r
+    printf ("ERROR : Can not allocate memory for SecEmuThunkPpi.  Exiting.\n");\r
+    exit (1);\r
+  }\r
+\r
+  CopyMem (SecEmuThunkPpi, &mSecEmuThunkPpi, sizeof (EMU_THUNK_PPI));\r
+  SecEmuThunkPpi->PersistentMemorySize = FixedPcdGet32 (PcdPersistentMemorySize);\r
+  AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, SecEmuThunkPpi);\r
 \r
   SecInitThunkProtocol ();\r
 \r