TianoCore EDK2 master
|
Go to the source code of this file.
Data Structures | |
struct | _EBC_THUNK_LIST |
struct | _EBC_IMAGE_LIST |
Typedefs | |
typedef struct _EBC_THUNK_LIST | EBC_THUNK_LIST |
typedef struct _EBC_IMAGE_LIST | EBC_IMAGE_LIST |
Variables | |
EBC_IMAGE_LIST * | mEbcImageList = NULL |
EBC_ICACHE_FLUSH | mEbcICacheFlush |
EFI_PERIODIC_CALLBACK | mDebugPeriodicCallback = NULL |
EFI_EXCEPTION_CALLBACK | mDebugExceptionCallback [MAX_EBC_EXCEPTION+1] = { NULL } |
VOID * | mStackBuffer [MAX_STACK_NUM] |
EFI_HANDLE | mStackBufferIndex [MAX_STACK_NUM] |
UINTN | mStackNum = 0 |
EFI_EVENT | mEbcPeriodicEvent |
VM_CONTEXT * | mVmPtr = NULL |
STATIC EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL | mPeCoffEmuProtocol |
Top level module for the EBC virtual machine implementation. Provides auxiliary support routines for the VM. That is, routines that are not particularly related to VM execution of EBC instructions.
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file EbcInt.c.
typedef struct _EBC_IMAGE_LIST EBC_IMAGE_LIST |
typedef struct _EBC_THUNK_LIST EBC_THUNK_LIST |
VOID EFIAPI CommonEbcExceptionHandler | ( | IN EFI_EXCEPTION_TYPE | InterruptType, |
IN EFI_SYSTEM_CONTEXT | SystemContext | ||
) |
EFI_STATUS EbcAddImageThunk | ( | IN EFI_HANDLE | ImageHandle, |
IN VOID * | ThunkBuffer, | ||
IN UINT32 | ThunkSize | ||
) |
Add a thunk to our list of thunks for a given image handle. Also flush the instruction cache since we've written thunk code to memory that will be executed eventually.
ImageHandle | The image handle to which the thunk is tied. |
ThunkBuffer | The buffer that has been created/allocated. |
ThunkSize | The size of the thunk memory allocated. |
EFI_OUT_OF_RESOURCES | Memory allocation failed. |
EFI_SUCCESS | The function completed successfully. |
EFI_STATUS EFIAPI EbcCreateThunk | ( | IN EFI_EBC_PROTOCOL * | This, |
IN EFI_HANDLE | ImageHandle, | ||
IN VOID * | EbcEntryPoint, | ||
OUT VOID ** | Thunk | ||
) |
This is the top-level routine plugged into the EBC protocol. Since thunks are very processor-specific, from here we dispatch directly to the very processor-specific routine EbcCreateThunks().
This | A pointer to the EFI_EBC_PROTOCOL instance. |
ImageHandle | Handle of image for which the thunk is being created. The EBC interpreter may use this to keep track of any resource allocations performed in loading and executing the image. |
EbcEntryPoint | Address of the actual EBC entry point or protocol service the thunk should call. |
Thunk | Returned pointer to a thunk created. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Image entry point is not 2-byte aligned. |
EFI_OUT_OF_RESOURCES | Memory could not be allocated for the thunk. |
EFI_STATUS EFIAPI EbcDebugGetMaximumProcessorIndex | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
OUT UINTN * | MaxProcessorIndex | ||
) |
This EBC debugger protocol service is called by the debug agent
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
MaxProcessorIndex | Pointer to a caller-allocated UINTN in which the maximum supported processor index is returned. |
EFI_SUCCESS | The function completed successfully. |
EFI_STATUS EFIAPI EbcDebugInvalidateInstructionCache | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
IN UINTN | ProcessorIndex, | ||
IN VOID * | Start, | ||
IN UINT64 | Length | ||
) |
This EBC debugger protocol service is called by the debug agent. Required for DebugSupport compliance but is only stubbed out for EBC.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
ProcessorIndex | Specifies which processor the callback function applies to. |
Start | StartSpecifies the physical base of the memory range to be invalidated. |
Length | Specifies the minimum number of bytes in the processor's instruction cache to invalidate. |
EFI_SUCCESS | The function completed successfully. |
EFI_STATUS EFIAPI EbcDebugPeriodic | ( | IN VM_CONTEXT * | VmPtr | ) |
EFI_STATUS EFIAPI EbcDebugRegisterExceptionCallback | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
IN UINTN | ProcessorIndex, | ||
IN EFI_EXCEPTION_CALLBACK | ExceptionCallback, | ||
IN EFI_EXCEPTION_TYPE | ExceptionType | ||
) |
This protocol service is called by the debug agent to register a function for us to call when we detect an exception.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
ProcessorIndex | Specifies which processor the callback function applies to. |
ExceptionCallback | A pointer to a function of type EXCEPTION_CALLBACK that is called when the processor exception specified by ExceptionType occurs. Passing NULL unregisters any previously registered function associated with ExceptionType. |
ExceptionType | Specifies which processor exception to hook. |
EFI_SUCCESS | The function completed successfully. |
EFI_ALREADY_STARTED | Non-NULL ExceptionCallback parameter when a callback function was previously registered. |
EFI_INVALID_PARAMETER | ExceptionType parameter is negative or exceeds MAX_EBC_EXCEPTION. |
EFI_INVALID_PARAMETER | Null ExceptionCallback parameter when no callback function was previously registered. |
EFI_STATUS EFIAPI EbcDebugRegisterPeriodicCallback | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
IN UINTN | ProcessorIndex, | ||
IN EFI_PERIODIC_CALLBACK | PeriodicCallback | ||
) |
This protocol service is called by the debug agent to register a function for us to call on a periodic basis.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
ProcessorIndex | Specifies which processor the callback function applies to. |
PeriodicCallback | A pointer to a function of type PERIODIC_CALLBACK that is the main periodic entry point of the debug agent. It receives as a parameter a pointer to the full context of the interrupted execution thread. |
EFI_SUCCESS | The function completed successfully. |
EFI_ALREADY_STARTED | Non-NULL PeriodicCallback parameter when a callback function was previously registered. |
EFI_INVALID_PARAMETER | Null PeriodicCallback parameter when no callback function was previously registered. |
EFI_STATUS EbcDebugSignalException | ( | IN EFI_EXCEPTION_TYPE | ExceptionType, |
IN EXCEPTION_FLAGS | ExceptionFlags, | ||
IN VM_CONTEXT * | VmPtr | ||
) |
The VM interpreter calls this function when an exception is detected.
ExceptionType | Specifies the processor exception detected. |
ExceptionFlags | Specifies the exception context. |
VmPtr | Pointer to a VM context for passing info to the EFI debugger. |
EFI_SUCCESS | This function completed successfully. |
EFI_STATUS EFIAPI EbcGetVersion | ( | IN EFI_EBC_PROTOCOL * | This, |
IN OUT UINT64 * | Version | ||
) |
Called to get the version of the interpreter.
This | A pointer to the EFI_EBC_PROTOCOL instance. |
Version | Pointer to where to store the returned version of the interpreter. |
EFI_SUCCESS | The function completed successfully. |
EFI_INVALID_PARAMETER | Version pointer is NULL. |
BOOLEAN EFIAPI EbcIsImageSupported | ( | IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL * | This, |
IN UINT16 | ImageType, | ||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath | OPTIONAL | ||
) |
Check whether the emulator supports executing a certain PE/COFF image
[in] | This | This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure |
[in] | ImageType | Whether the image is an application, a boot time driver or a runtime driver. |
[in] | DevicePath | Path to device where the image originated (e.g., a PCI option ROM) |
TRUE | The image is supported by the emulator |
FALSE | The image is not supported by the emulator. |
The periodic callback function for EBC VM interpreter, which is used to support the EFI debug support protocol.
Event | The Periodic Callback Event. |
Context | It should be the address of VM_CONTEXT pointer. |
EFI_STATUS EFIAPI EbcRegisterICacheFlush | ( | IN EFI_EBC_PROTOCOL * | This, |
IN EBC_ICACHE_FLUSH | Flush | ||
) |
Registers a callback function that the EBC interpreter calls to flush the processor instruction cache following creation of thunks.
This | A pointer to the EFI_EBC_PROTOCOL instance. |
Flush | Pointer to a function of type EBC_ICACH_FLUSH. |
EFI_SUCCESS | The function completed successfully. |
EFI_STATUS EFIAPI EbcRegisterImage | ( | IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | ImageBase, | ||
IN UINT64 | ImageSize, | ||
IN OUT EFI_IMAGE_ENTRY_POINT * | EntryPoint | ||
) |
Register a supported PE/COFF image with the emulator. After this call completes successfully, the PE/COFF image may be started as usual, and it is the responsibility of the emulator implementation that any branch into the code section of the image (including returns from functions called from the foreign code) is executed as if it were running on the machine type it was built for.
[in] | This | This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure |
[in] | ImageBase | The base address in memory of the PE/COFF image |
[in] | ImageSize | The size in memory of the PE/COFF image |
[in,out] | EntryPoint | The entry point of the PE/COFF image. Passed by reference so that the emulator may modify it. |
EFI_SUCCESS | The image was registered with the emulator and can be started as usual. |
other | The image could not be registered. |
If the PE/COFF machine type or image type are not supported by the emulator, then ASSERT().
EFI_STATUS EFIAPI EbcUnloadImage | ( | IN EFI_EBC_PROTOCOL * | This, |
IN EFI_HANDLE | ImageHandle | ||
) |
This routine is called by the core when an image is being unloaded from memory. Basically we now have the opportunity to do any necessary cleanup. Typically this will include freeing any memory allocated for thunk-creation.
This | A pointer to the EFI_EBC_PROTOCOL instance. |
ImageHandle | Handle of image for which the thunk is being created. |
EFI_INVALID_PARAMETER | The ImageHandle passed in was not found in the internal list of EBC image handles. |
EFI_SUCCESS | The function completed successfully. |
EFI_STATUS EFIAPI EbcUnregisterImage | ( | IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | ImageBase | ||
) |
Unregister a PE/COFF image that has been registered with the emulator. This should be done before the image is unloaded from memory.
[in] | This | This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure |
[in] | ImageBase | The base address in memory of the PE/COFF image |
EFI_SUCCESS | The image was unregistered with the emulator. |
other | Image could not be unloaded. |
EFI_STATUS EFIAPI EbcVmTestUnsupported | ( | VOID | ) |
EFI_STATUS FreeEBCStack | ( | VOID | ) |
EFI_STATUS GetEBCStack | ( | IN EFI_HANDLE | Handle, |
OUT VOID ** | StackBuffer, | ||
OUT UINTN * | BufferIndex | ||
) |
Returns the stack index and buffer assosicated with the Handle parameter.
Handle | The EFI handle as the index to the EBC stack. |
StackBuffer | A pointer to hold the returned stack buffer. |
BufferIndex | A pointer to hold the returned stack index. |
EFI_OUT_OF_RESOURCES | The Handle parameter does not correspond to any existing EBC stack. |
EFI_SUCCESS | The stack index and buffer were found and returned to the caller. |
EFI_STATUS InitEBCStack | ( | VOID | ) |
EFI_STATUS InitEbcVmTestProtocol | ( | IN EFI_HANDLE * | IHandle | ) |
EFI_STATUS EFIAPI InitializeEbcCallback | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This | ) |
EFI_STATUS EFIAPI InitializeEbcDriver | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
EFI_STATUS ReturnEBCStack | ( | IN UINTN | Index | ) |
EFI_STATUS ReturnEBCStackByHandle | ( | IN EFI_HANDLE | Handle | ) |
EFI_EXCEPTION_CALLBACK mDebugExceptionCallback[MAX_EBC_EXCEPTION+1] = { NULL } |
EFI_PERIODIC_CALLBACK mDebugPeriodicCallback = NULL |
EBC_ICACHE_FLUSH mEbcICacheFlush |
EBC_IMAGE_LIST* mEbcImageList = NULL |
STATIC EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL mPeCoffEmuProtocol |
EFI_HANDLE mStackBufferIndex[MAX_STACK_NUM] |
VM_CONTEXT* mVmPtr = NULL |