TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiEmuPeCoffExtraActionLib.c
Go to the documentation of this file.
1
11#include <PiPei.h>
12#include <Ppi/EmuThunk.h>
13#include <Protocol/EmuThunk.h>
14
15#include <Library/PeCoffLib.h>
17#include <Library/DebugLib.h>
18#include <Library/BaseLib.h>
20#include <Library/EmuMagicPageLib.h>
21
22//
23// Cache of UnixThunk protocol
24//
25EMU_THUNK_PROTOCOL *mThunk = NULL;
26
35EFIAPI
37 )
38{
39 EMU_THUNK_PPI *ThunkPpi;
40 EFI_STATUS Status;
41
42 //
43 // Locate Unix ThunkPpi for retrieving standard output handle
44 //
45 Status = PeiServicesLocatePpi (
46 &gEmuThunkPpiGuid,
47 0,
48 NULL,
49 (VOID **)&ThunkPpi
50 );
51 ASSERT_EFI_ERROR (Status);
52
53 EMU_MAGIC_PAGE ()->Thunk = (EMU_THUNK_PROTOCOL *)ThunkPpi->Thunk ();
54
55 return EFI_SUCCESS;
56}
57
67VOID
68EFIAPI
71 )
72{
73 if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
75 }
76
77 EMU_MAGIC_PAGE ()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
78}
79
90VOID
91EFIAPI
94 )
95{
96 if (EMU_MAGIC_PAGE ()->Thunk == NULL) {
98 }
99
100 EMU_MAGIC_PAGE ()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
101}
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
VOID EFIAPI PeCoffLoaderUnloadImageExtraAction(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
EFI_STATUS EFIAPI EmuPeCoffGetThunkStucture()
VOID EFIAPI PeCoffLoaderRelocateImageExtraAction(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112