]>
Commit | Line | Data |
---|---|---|
f72f8177 AB |
1 | /** @file\r |
2 | Copyright (c) 2019, Linaro, Ltd. All rights reserved.<BR>\r | |
3 | \r | |
4 | This program and the accompanying materials are licensed and made available\r | |
5 | under the terms and conditions of the BSD License which accompanies this\r | |
6 | distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | **/\r | |
13 | \r | |
14 | #ifndef _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_\r | |
15 | #define _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_\r | |
16 | \r | |
17 | #define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \\r | |
18 | { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA, 0x97 } }\r | |
19 | \r | |
20 | typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;\r | |
21 | \r | |
22 | /**\r | |
23 | Check whether the emulator supports executing a certain PE/COFF image\r | |
24 | \r | |
25 | @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL\r | |
26 | structure\r | |
27 | @param[in] ImageType Whether the image is an application, a boot time\r | |
28 | driver or a runtime driver.\r | |
29 | @param[in] DevicePath Path to device where the image originated\r | |
30 | (e.g., a PCI option ROM)\r | |
31 | \r | |
32 | @retval TRUE The image is supported by the emulator\r | |
33 | @retval FALSE The image is not supported by the emulator.\r | |
34 | **/\r | |
35 | typedef\r | |
36 | BOOLEAN\r | |
37 | (EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED) (\r | |
38 | IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,\r | |
39 | IN UINT16 ImageType,\r | |
40 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL\r | |
41 | );\r | |
42 | \r | |
43 | /**\r | |
44 | Register a supported PE/COFF image with the emulator. After this call\r | |
45 | completes successfully, the PE/COFF image may be started as usual, and\r | |
46 | it is the responsibility of the emulator implementation that any branch\r | |
47 | into the code section of the image (including returns from functions called\r | |
48 | from the foreign code) is executed as if it were running on the machine\r | |
49 | type it was built for.\r | |
50 | \r | |
51 | @param[in] This This pointer for\r | |
52 | EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure\r | |
53 | @param[in] ImageBase The base address in memory of the PE/COFF image\r | |
54 | @param[in] ImageSize The size in memory of the PE/COFF image\r | |
55 | @param[in,out] EntryPoint The entry point of the PE/COFF image. Passed by\r | |
56 | reference so that the emulator may modify it.\r | |
57 | \r | |
58 | @retval EFI_SUCCESS The image was registered with the emulator and\r | |
59 | can be started as usual.\r | |
60 | @retval other The image could not be registered.\r | |
61 | \r | |
62 | If the PE/COFF machine type or image type are not supported by the emulator,\r | |
63 | then ASSERT().\r | |
64 | **/\r | |
65 | typedef\r | |
66 | EFI_STATUS\r | |
67 | (EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE) (\r | |
68 | IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,\r | |
69 | IN EFI_PHYSICAL_ADDRESS ImageBase,\r | |
70 | IN UINT64 ImageSize,\r | |
71 | IN OUT EFI_IMAGE_ENTRY_POINT *EntryPoint\r | |
72 | );\r | |
73 | \r | |
74 | /**\r | |
75 | Unregister a PE/COFF image that has been registered with the emulator.\r | |
76 | This should be done before the image is unloaded from memory.\r | |
77 | \r | |
78 | @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL\r | |
79 | structure\r | |
80 | @param[in] ImageBase The base address in memory of the PE/COFF image\r | |
81 | \r | |
82 | @retval EFI_SUCCESS The image was unregistered with the emulator.\r | |
83 | @retval other Image could not be unloaded.\r | |
84 | **/\r | |
85 | typedef\r | |
86 | EFI_STATUS\r | |
87 | (EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE) (\r | |
88 | IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,\r | |
89 | IN EFI_PHYSICAL_ADDRESS ImageBase\r | |
90 | );\r | |
91 | \r | |
92 | #define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1\r | |
93 | \r | |
94 | typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {\r | |
95 | EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED IsImageSupported;\r | |
96 | EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE RegisterImage;\r | |
97 | EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE UnregisterImage;\r | |
98 | \r | |
99 | // Protocol version implemented by the emulator\r | |
100 | UINT32 Version;\r | |
101 | // The machine type implemented by the emulator\r | |
102 | UINT16 MachineType;\r | |
103 | } EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;\r | |
104 | \r | |
105 | extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid;\r | |
106 | \r | |
107 | #endif\r |