-/**@file
-
-Copyright (c) 2006 - 2009, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
-
- PeiUnixPeCoffExtraActionLib.c
-
-Abstract:
-
- Provides services to perform additional actions to relocate and unload
- PE/Coff image for UNIX environment specific purpose such as souce level debug.
- This version only works for PEI phase
-
-
-**/
-#include <PiPei.h>
-#include <Ppi/UnixThunk.h>
-#include <FrameworkModuleBase.h>
-
-#include <Library/PeCoffLib.h>
-#include <Library/PeiServicesLib.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/PeCoffExtraActionLib.h>
-
-//
-// Cache of UnixThunk protocol
-//
-EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;
-
-/**
- The function caches the pointer of the WinNT thunk functions
- It will ASSERT() if Unix thunk ppi is not installed.
-
- @retval EFI_SUCCESS WinNT thunk protocol is found and cached.
-
-**/
-EFI_STATUS
-EFIAPI
-UnixPeCoffGetUnixThunkStucture (
- )
-{
- PEI_UNIX_THUNK_PPI *UnixThunkPpi;
- EFI_STATUS Status;
-
-
- //
- // Locate Unix ThunkPpi for retrieving standard output handle
- //
- Status = PeiServicesLocatePpi (
- &gPeiUnixThunkPpiGuid,
- 0,
- NULL,
- (VOID **) &UnixThunkPpi
- );
-
- ASSERT_EFI_ERROR (Status);
-
- mUnix = (EFI_UNIX_THUNK_PROTOCOL *) UnixThunkPpi->UnixThunk ();
-
- return EFI_SUCCESS;
-}
-
-/**
+/**@file\r
+\r
+Copyright (c) 2006 - 2009, Intel Corporation\r
+All rights reserved. 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
+Module Name:\r
+\r
+ PeiUnixPeCoffExtraActionLib.c\r
+\r
+Abstract:\r
+\r
+ Provides services to perform additional actions to relocate and unload\r
+ PE/Coff image for UNIX environment specific purpose such as souce level debug.\r
+ This version only works for PEI phase\r
+\r
+\r
+**/\r
+#include <PiPei.h>\r
+#include <Ppi/UnixThunk.h>\r
+\r
+#include <Library/PeCoffLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
+\r
+//\r
+// Cache of UnixThunk protocol \r
+//\r
+EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;\r
+\r
+/**\r
+ The function caches the pointer of the WinNT thunk functions\r
+ It will ASSERT() if Unix thunk ppi is not installed.\r
+\r
+ @retval EFI_SUCCESS WinNT thunk protocol is found and cached.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UnixPeCoffGetUnixThunkStucture (\r
+ )\r
+{\r
+ PEI_UNIX_THUNK_PPI *UnixThunkPpi;\r
+ EFI_STATUS Status;\r
+\r
+ \r
+ //\r
+ // Locate Unix ThunkPpi for retrieving standard output handle\r
+ //\r
+ Status = PeiServicesLocatePpi (\r
+ &gPeiUnixThunkPpiGuid,\r
+ 0,\r
+ NULL,\r
+ (VOID **) &UnixThunkPpi\r
+ );\r
+\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ mUnix = (EFI_UNIX_THUNK_PROTOCOL *) UnixThunkPpi->UnixThunk ();\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
Performs additional actions after a PE/COFF image has been loaded and relocated.\r
\r
If ImageContext is NULL, then ASSERT().\r
\r
@param ImageContext Pointer to the image context structure that describes the\r
PE/COFF image that has already been loaded and relocated.\r
-
-**/
-VOID
-EFIAPI
-PeCoffLoaderRelocateImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeCoffLoaderRelocateImageExtraAction (\r
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext\r
+ )\r
+{\r
VOID * Handle;\r
VOID * Entry;\r
\r
ASSERT (ImageContext != NULL);\r
\r
Handle = NULL;\r
- Entry = NULL;
-
- if (mUnix == NULL) {
- UnixPeCoffGetUnixThunkStucture ();
- }
+ Entry = NULL;\r
+ \r
+ if (mUnix == NULL) {\r
+ UnixPeCoffGetUnixThunkStucture ();\r
+ }\r
DEBUG ((EFI_D_ERROR, "Loading %a 0x%08lx - entry point 0x%08lx\n",\r
ImageContext->PdbPointer,\r
(UINTN)ImageContext->ImageAddress,\r
\r
if (Handle) {\r
Entry = mUnix->Dlsym(Handle, "_ModuleEntryPoint");\r
- } else {
+ } else {\r
DEBUG ((EFI_D_ERROR, "%a\n", mUnix->Dlerror()));\r
}\r
\r
if (Entry != NULL) {\r
- ImageContext->EntryPoint = Entry;
+ ImageContext->EntryPoint = Entry;\r
DEBUG ((EFI_D_ERROR, "Change %a Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, Entry));\r
}\r
\r
\r
- return;
- }
-
-/**
+ return;\r
+ } \r
+\r
+/**\r
Performs additional actions just before a PE/COFF image is unloaded. Any resources\r
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.\r
\r
\r
@param ImageContext Pointer to the image context structure that describes the\r
PE/COFF image that is being unloaded.\r
-
-**/
-VOID
-EFIAPI
-PeCoffLoaderUnloadImageExtraAction (
- IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
- )
-{
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeCoffLoaderUnloadImageExtraAction (\r
+ IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext\r
+ )\r
+{\r
ASSERT (ImageContext != NULL);\r
-}
+}\r