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
>
16
#include <
Library/PeiServicesLib.h
>
17
#include <
Library/DebugLib.h
>
18
#include <
Library/BaseLib.h
>
19
#include <
Library/PeCoffExtraActionLib.h
>
20
#include <Library/EmuMagicPageLib.h>
21
22
//
23
// Cache of UnixThunk protocol
24
//
25
EMU_THUNK_PROTOCOL
*mThunk =
NULL
;
26
34
EFI_STATUS
35
EFIAPI
36
EmuPeCoffGetThunkStucture
(
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
67
VOID
68
EFIAPI
69
PeCoffLoaderRelocateImageExtraAction
(
70
IN
OUT
PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
71
)
72
{
73
if
(EMU_MAGIC_PAGE ()->Thunk ==
NULL
) {
74
EmuPeCoffGetThunkStucture
();
75
}
76
77
EMU_MAGIC_PAGE ()->Thunk->PeCoffRelocateImageExtraAction (ImageContext);
78
}
79
90
VOID
91
EFIAPI
92
PeCoffLoaderUnloadImageExtraAction
(
93
IN
OUT
PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
94
)
95
{
96
if
(EMU_MAGIC_PAGE ()->Thunk ==
NULL
) {
97
EmuPeCoffGetThunkStucture
();
98
}
99
100
EMU_MAGIC_PAGE ()->Thunk->PeCoffUnloadImageExtraAction (ImageContext);
101
}
BaseLib.h
PeiServicesLocatePpi
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
Definition:
PeiServicesLib.c:95
NULL
#define NULL
Definition:
Base.h:319
IN
#define IN
Definition:
Base.h:279
OUT
#define OUT
Definition:
Base.h:284
DebugLib.h
ASSERT_EFI_ERROR
#define ASSERT_EFI_ERROR(StatusParameter)
Definition:
DebugLib.h:462
PeCoffExtraActionLib.h
PeCoffLib.h
PeCoffLoaderUnloadImageExtraAction
VOID EFIAPI PeCoffLoaderUnloadImageExtraAction(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
Definition:
PeiEmuPeCoffExtraActionLib.c:92
EmuPeCoffGetThunkStucture
EFI_STATUS EFIAPI EmuPeCoffGetThunkStucture()
Definition:
PeiEmuPeCoffExtraActionLib.c:36
PeCoffLoaderRelocateImageExtraAction
VOID EFIAPI PeCoffLoaderRelocateImageExtraAction(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
Definition:
PeiEmuPeCoffExtraActionLib.c:69
PeiServicesLib.h
PiPei.h
EmuThunk.h
EmuThunk.h
EFI_STATUS
RETURN_STATUS EFI_STATUS
Definition:
UefiBaseType.h:29
EFI_SUCCESS
#define EFI_SUCCESS
Definition:
UefiBaseType.h:112
_EMU_THUNK_PROTOCOL
Definition:
EmuThunk.h:202
EMU_THUNK_PPI
Definition:
EmuThunk.h:106
PE_COFF_LOADER_IMAGE_CONTEXT
Definition:
PeCoffLib.h:75
EmulatorPkg
Library
PeiEmuPeCoffExtraActionLib
PeiEmuPeCoffExtraActionLib.c
Generated on Fri Nov 15 2024 18:01:07 for TianoCore EDK2 by
1.9.6