2 Copyright (c) 2019, Linaro, Ltd. All rights reserved.<BR>
3 SPDX-License-Identifier: BSD-2-Clause-Patent
7 #ifndef _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_
8 #define _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_
10 #define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \
11 { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA, 0x97 } }
13 typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
;
16 Check whether the emulator supports executing a certain PE/COFF image
18 @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
20 @param[in] ImageType Whether the image is an application, a boot time
21 driver or a runtime driver.
22 @param[in] DevicePath Path to device where the image originated
23 (e.g., a PCI option ROM)
25 @retval TRUE The image is supported by the emulator
26 @retval FALSE The image is not supported by the emulator.
30 (EFIAPI
*EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED
)(
31 IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
*This
,
33 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath OPTIONAL
37 Register a supported PE/COFF image with the emulator. After this call
38 completes successfully, the PE/COFF image may be started as usual, and
39 it is the responsibility of the emulator implementation that any branch
40 into the code section of the image (including returns from functions called
41 from the foreign code) is executed as if it were running on the machine
42 type it was built for.
44 @param[in] This This pointer for
45 EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure
46 @param[in] ImageBase The base address in memory of the PE/COFF image
47 @param[in] ImageSize The size in memory of the PE/COFF image
48 @param[in,out] EntryPoint The entry point of the PE/COFF image. Passed by
49 reference so that the emulator may modify it.
51 @retval EFI_SUCCESS The image was registered with the emulator and
52 can be started as usual.
53 @retval other The image could not be registered.
55 If the PE/COFF machine type or image type are not supported by the emulator,
60 (EFIAPI
*EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE
)(
61 IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
*This
,
62 IN EFI_PHYSICAL_ADDRESS ImageBase
,
64 IN OUT EFI_IMAGE_ENTRY_POINT
*EntryPoint
68 Unregister a PE/COFF image that has been registered with the emulator.
69 This should be done before the image is unloaded from memory.
71 @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
73 @param[in] ImageBase The base address in memory of the PE/COFF image
75 @retval EFI_SUCCESS The image was unregistered with the emulator.
76 @retval other Image could not be unloaded.
80 (EFIAPI
*EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE
)(
81 IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
*This
,
82 IN EFI_PHYSICAL_ADDRESS ImageBase
85 #define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1
87 typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
{
88 EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED IsImageSupported
;
89 EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE RegisterImage
;
90 EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE UnregisterImage
;
92 // Protocol version implemented by the emulator
94 // The machine type implemented by the emulator
96 } EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
;
98 extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid
;