TianoCore EDK2 master
Loading...
Searching...
No Matches
EmuThunk.h
Go to the documentation of this file.
1
11#ifndef __EMU_THUNK_PROTOCOL_H__
12#define __EMU_THUNK_PROTOCOL_H__
13
14#define EMU_THUNK_PROTOCOL_GUID \
15 { 0x5CF32E0B, 0x8EDF, 0x2E44, { 0x9C, 0xDA, 0x93, 0x20, 0x5E, 0x99, 0xEC, 0x1C } }
16
17// neded for things like EFI_TIME_CAPABILITIES
18#include <Uefi.h>
19
21
22#include <Protocol/EmuIoThunk.h>
23#include <Protocol/DevicePath.h>
24
25typedef struct {
26 VENDOR_DEVICE_PATH VendorDevicePath;
27 UINT32 Instance;
29
30typedef struct {
32 EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
34
36
37typedef
39(EFIAPI *EMU_WRITE_STD_ERROR)(
40 IN UINT8 *Buffer,
41 IN UINTN NumberOfBytes
42 );
43
44typedef
46(EFIAPI *EMU_CONFIG_STD_IN)(
47 VOID
48 );
49
50typedef
52(EFIAPI *EMU_WRITE_STD_OUT)(
53 IN UINT8 *Buffer,
54 IN UINTN NumberOfBytes
55 );
56
57typedef
59(EFIAPI *EMU_READ_STD_IN)(
60 OUT UINT8 *Buffer,
61 IN UINTN NumberOfBytes
62 );
63
64typedef
65BOOLEAN
66(EFIAPI *EMU_POLL_STD_IN)(
67 VOID
68 );
69
70typedef
71VOID *
72(EFIAPI *EMU_OS_MALLOC)(
73 IN UINTN Size
74 );
75
76typedef
77VOID *
78(EFIAPI *EMU_OS_VMALLOC)(
79 IN UINTN Size
80 );
81
82typedef
83BOOLEAN
84(EFIAPI *EMU_OS_FREE)(
85 IN VOID *Ptr
86 );
87
88typedef
90(EFIAPI *EMU_PE_COFF_GET_ENTRY_POINT)(
91 IN VOID *Pe32Data,
92 IN OUT VOID **EntryPoint
93 );
94
95typedef
96VOID
97(EFIAPI *EMU_PE_COFF_RELOCATE_EXTRA_ACTION)(
99 );
100
101typedef
102VOID
103(EFIAPI *EMU_PE_COFF_UNLOAD_EXTRA_ACTION)(
105 );
106
107typedef
108VOID
109(EFIAPI *EMU_ENABLE_INERRUPTS)(
110 VOID
111 );
112
113typedef
114VOID
115(EFIAPI *EMU_DISABLE_INERRUPTS)(
116 VOID
117 );
118
119typedef
120UINT64
121(EFIAPI *EMU_QUERY_PERFORMANCE_FREQENCY)(
122 VOID
123 );
124
125typedef
126UINT64
127(EFIAPI *EMU_QUERY_PERFORMANCE_COUNTER)(
128 VOID
129 );
130
131typedef
132VOID
133(EFIAPI *EMU_SLEEP)(
134 IN UINT64 Nanoseconds
135 );
136
137typedef
138VOID
139(EFIAPI *EMU_CPU_SLEEP)(
140 VOID
141 );
142
143typedef
144VOID
145(EFIAPI *EMU_EXIT)(
146 IN UINTN Status
147 );
148
149typedef
150VOID
151(EFIAPI *EMU_GET_TIME)(
152 OUT EFI_TIME *Time,
154 );
155
156typedef
158(EFIAPI *EMU_SET_TIME)(
159 IN EFI_TIME *Time
160 );
161
162typedef
163VOID
164(EFIAPI EMU_SET_TIMER_CALLBACK)(
165 IN UINT64 DeltaMs
166 );
167
168typedef
169VOID
170(EFIAPI *EMU_SET_TIMER)(
171 IN UINT64 PeriodMs,
172 IN EMU_SET_TIMER_CALLBACK CallBack
173 );
174
195typedef
197(EFIAPI *EMU_GET_NEXT_PROTOCOL)(
198 IN BOOLEAN EmuBusDriver,
200 );
201
203 // Used for early debug printing
204 EMU_WRITE_STD_ERROR WriteStdErr;
205 EMU_CONFIG_STD_IN ConfigStdIn;
206 EMU_WRITE_STD_OUT WriteStdOut;
207 EMU_READ_STD_IN ReadStdIn;
208 EMU_POLL_STD_IN PollStdIn;
209
210 //
211 // Map OS malloc/free so we can use OS based guard malloc
212 //
213 EMU_OS_MALLOC Malloc;
214 EMU_OS_VMALLOC Valloc;
215 EMU_OS_FREE Free;
216
220 EMU_PE_COFF_GET_ENTRY_POINT PeCoffGetEntryPoint;
221 EMU_PE_COFF_RELOCATE_EXTRA_ACTION PeCoffRelocateImageExtraAction;
222 EMU_PE_COFF_UNLOAD_EXTRA_ACTION PeCoffUnloadImageExtraAction;
223
227 EMU_ENABLE_INERRUPTS EnableInterrupt;
228 EMU_DISABLE_INERRUPTS DisableInterrupt;
229 EMU_QUERY_PERFORMANCE_FREQENCY QueryPerformanceFrequency;
230 EMU_QUERY_PERFORMANCE_COUNTER QueryPerformanceCounter;
231
232 EMU_SLEEP Sleep;
233 EMU_CPU_SLEEP CpuSleep;
234 EMU_EXIT Exit;
235 EMU_GET_TIME GetTime;
236 EMU_SET_TIME SetTime;
237 EMU_SET_TIMER SetTimer;
238
243};
244
245extern EFI_GUID gEmuThunkProtocolGuid;
246
247#endif
UINT64 UINTN
#define OPTIONAL
Definition: Base.h:290
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS(EFIAPI * EMU_GET_NEXT_PROTOCOL)(IN BOOLEAN EmuBusDriver, OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL)
Definition: EmuThunk.h:197
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
EMU_GET_NEXT_PROTOCOL GetNextProtocol
Definition: EmuThunk.h:242
EMU_ENABLE_INERRUPTS EnableInterrupt
Definition: EmuThunk.h:227
EMU_PE_COFF_GET_ENTRY_POINT PeCoffGetEntryPoint
Definition: EmuThunk.h:220
Definition: Base.h:213