TianoCore EDK2 master
Loading...
Searching...
No Matches
EbcInt.h
Go to the documentation of this file.
1
10#ifndef _EBC_INT_H_
11#define _EBC_INT_H_
12
13#include <Uefi.h>
14
16#include <Protocol/Ebc.h>
17#include <Protocol/EbcVmTest.h>
20
21#include <Library/BaseLib.h>
23#include <Library/DebugLib.h>
24#include <Library/PeCoffLib.h>
29
30extern VM_CONTEXT *mVmPtr;
31
32//
33// Flags passed to the internal create-thunks function.
34//
35#define FLAG_THUNK_ENTRY_POINT 0x01 // thunk for an image entry point
36#define FLAG_THUNK_PROTOCOL 0x00 // thunk for an EBC protocol service
37//
38// Put this value at the bottom of the VM's stack gap so we can check it on
39// occasion to make sure the stack has not been corrupted.
40//
41#define VM_STACK_KEY_VALUE 0xDEADBEEF
42
62 IN EFI_HANDLE ImageHandle,
63 IN VOID *EbcEntryPoint,
64 OUT VOID **Thunk,
65 IN UINT32 Flags
66 );
67
83 IN EFI_HANDLE ImageHandle,
84 IN VOID *ThunkBuffer,
85 IN UINT32 ThunkSize
86 );
87
88//
89// Define a constant of how often to call the debugger periodic callback
90// function.
91//
92#define EFI_TIMER_UNIT_1MS (1000 * 10)
93#define EBC_VM_PERIODIC_CALLBACK_RATE (1000 * EFI_TIMER_UNIT_1MS)
94#define STACK_POOL_SIZE (1024 * 1020)
95#define MAX_STACK_NUM 4
96
97//
98// External low level functions that are native-processor dependent
99//
100
110UINTN
111EFIAPI
113 VOID
114 );
115
131INT64
132EFIAPI
134 IN UINTN CallAddr,
135 IN UINTN EbcSp,
136 IN VOID *FramePtr
137 );
138
154VOID
156 IN VM_CONTEXT *VmPtr,
157 IN UINTN FuncAddr,
158 IN UINTN NewStackPointer,
159 IN VOID *FramePtr,
160 IN UINT8 Size
161 );
162
178 IN EFI_HANDLE Handle,
179 OUT VOID **StackBuffer,
180 OUT UINTN *BufferIndex
181 );
182
193 IN UINTN Index
194 );
195
205 VOID
206 );
207
216 VOID
217 );
218
229 IN EFI_HANDLE Handle
230 );
231
232typedef struct {
233 EFI_EBC_PROTOCOL *This;
234 VOID *EntryPoint;
235 EFI_HANDLE ImageHandle;
236 VM_CONTEXT VmContext;
238
239#define EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('e', 'b', 'c', 'p')
240
241#define EBC_PROTOCOL_PRIVATE_DATA_FROM_THIS(a) \
242 CR(a, EBC_PROTOCOL_PRIVATE_DATA, EbcProtocol, EBC_PROTOCOL_PRIVATE_DATA_SIGNATURE)
243
252VOID *
253EFIAPI
255 IN UINTN AllocationSize
256 );
257
258#endif // #ifndef _EBC_INT_H_
UINT64 UINTN
EFI_STATUS EbcAddImageThunk(IN EFI_HANDLE ImageHandle, IN VOID *ThunkBuffer, IN UINT32 ThunkSize)
Definition: EbcInt.c:1239
VOID *EFIAPI EbcAllocatePoolForThunk(IN UINTN AllocationSize)
Definition: EbcInt.c:1554
EFI_STATUS ReturnEBCStackByHandle(IN EFI_HANDLE Handle)
Definition: EbcInt.c:1417
EFI_STATUS FreeEBCStack(VOID)
Definition: EbcInt.c:1471
UINTN EFIAPI EbcLLGetEbcEntryPoint(VOID)
INT64 EFIAPI EbcLLCALLEXNative(IN UINTN CallAddr, IN UINTN EbcSp, IN VOID *FramePtr)
VOID EbcLLCALLEX(IN VM_CONTEXT *VmPtr, IN UINTN FuncAddr, IN UINTN NewStackPointer, IN VOID *FramePtr, IN UINT8 Size)
Definition: EbcSupport.c:436
EFI_STATUS InitEBCStack(VOID)
Definition: EbcInt.c:1445
EFI_STATUS ReturnEBCStack(IN UINTN Index)
Definition: EbcInt.c:1400
EFI_STATUS EbcCreateThunks(IN EFI_HANDLE ImageHandle, IN VOID *EbcEntryPoint, OUT VOID **Thunk, IN UINT32 Flags)
Definition: EbcSupport.c:362
EFI_STATUS GetEBCStack(IN EFI_HANDLE Handle, OUT VOID **StackBuffer, OUT UINTN *BufferIndex)
Definition: EbcInt.c:1364
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33