--- /dev/null
+/*++ @file\r
+ UEFI/PI PEIM to abstract construction of firmware volume in a Unix environment.\r
+\r
+Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
+Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.\r
+This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+#include <PiPei.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/PeiServicesTablePointerLib.h>\r
+\r
+#include <Ppi/EmuThunk.h>\r
+#include <Protocol/EmuThunk.h>\r
+\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeiInitialzeThunkPpiToProtocolPei (\r
+ IN EFI_PEI_FILE_HANDLE FileHandle,\r
+ IN CONST EFI_PEI_SERVICES **PeiServices\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Perform a call-back into the SEC simulator to get Unix Stuff\r
+\r
+Arguments:\r
+\r
+ PeiServices - General purpose services available to every PEIM.\r
+ \r
+Returns:\r
+\r
+ None\r
+\r
+**/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;\r
+ EMU_THUNK_PPI *Thunk;\r
+ VOID *Ptr;\r
+\r
+ DEBUG ((EFI_D_ERROR, "Emu Thunk PEIM Loaded\n"));\r
+\r
+ Status = PeiServicesLocatePpi (\r
+ &gEmuThunkPpiGuid, // GUID\r
+ 0, // INSTANCE\r
+ &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
+ (VOID **)&Thunk // PPI\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ Ptr = Thunk->Thunk ();\r
+\r
+ BuildGuidDataHob (\r
+ &gEmuThunkProtocolGuid, // Guid\r
+ &Ptr, // Buffer\r
+ sizeof (VOID *) // Sizeof Buffer\r
+ );\r
+ return Status;\r
+}\r