]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Protocol/PeCoffImageEmulator.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / PeCoffImageEmulator.h
CommitLineData
f72f8177
AB
1/** @file\r
2 Copyright (c) 2019, Linaro, Ltd. All rights reserved.<BR>\r
2eea9c6f 3 SPDX-License-Identifier: BSD-2-Clause-Patent\r
f72f8177
AB
4\r
5**/\r
6\r
7#ifndef _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_\r
8#define _PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID_H_\r
9\r
10#define EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL_GUID \\r
11 { 0x96F46153, 0x97A7, 0x4793, { 0xAC, 0xC1, 0xFA, 0x19, 0xBF, 0x78, 0xEA, 0x97 } }\r
12\r
13typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;\r
14\r
15/**\r
16 Check whether the emulator supports executing a certain PE/COFF image\r
17\r
18 @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL\r
19 structure\r
20 @param[in] ImageType Whether the image is an application, a boot time\r
21 driver or a runtime driver.\r
22 @param[in] DevicePath Path to device where the image originated\r
23 (e.g., a PCI option ROM)\r
24\r
25 @retval TRUE The image is supported by the emulator\r
26 @retval FALSE The image is not supported by the emulator.\r
27**/\r
28typedef\r
29BOOLEAN\r
1436aea4 30(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED)(\r
f72f8177
AB
31 IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,\r
32 IN UINT16 ImageType,\r
33 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL\r
34 );\r
35\r
36/**\r
37 Register a supported PE/COFF image with the emulator. After this call\r
38 completes successfully, the PE/COFF image may be started as usual, and\r
39 it is the responsibility of the emulator implementation that any branch\r
40 into the code section of the image (including returns from functions called\r
41 from the foreign code) is executed as if it were running on the machine\r
42 type it was built for.\r
43\r
44 @param[in] This This pointer for\r
45 EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL structure\r
46 @param[in] ImageBase The base address in memory of the PE/COFF image\r
47 @param[in] ImageSize The size in memory of the PE/COFF image\r
48 @param[in,out] EntryPoint The entry point of the PE/COFF image. Passed by\r
49 reference so that the emulator may modify it.\r
50\r
51 @retval EFI_SUCCESS The image was registered with the emulator and\r
52 can be started as usual.\r
53 @retval other The image could not be registered.\r
54\r
55 If the PE/COFF machine type or image type are not supported by the emulator,\r
56 then ASSERT().\r
57**/\r
58typedef\r
59EFI_STATUS\r
1436aea4 60(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE)(\r
f72f8177
AB
61 IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,\r
62 IN EFI_PHYSICAL_ADDRESS ImageBase,\r
63 IN UINT64 ImageSize,\r
64 IN OUT EFI_IMAGE_ENTRY_POINT *EntryPoint\r
65 );\r
66\r
67/**\r
68 Unregister a PE/COFF image that has been registered with the emulator.\r
69 This should be done before the image is unloaded from memory.\r
70\r
71 @param[in] This This pointer for EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL\r
72 structure\r
73 @param[in] ImageBase The base address in memory of the PE/COFF image\r
74\r
75 @retval EFI_SUCCESS The image was unregistered with the emulator.\r
76 @retval other Image could not be unloaded.\r
77**/\r
78typedef\r
79EFI_STATUS\r
1436aea4 80(EFIAPI *EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE)(\r
f72f8177
AB
81 IN EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *This,\r
82 IN EFI_PHYSICAL_ADDRESS ImageBase\r
83 );\r
84\r
1436aea4 85#define EDKII_PECOFF_IMAGE_EMULATOR_VERSION 0x1\r
f72f8177
AB
86\r
87typedef struct _EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL {\r
88 EDKII_PECOFF_IMAGE_EMULATOR_IS_IMAGE_SUPPORTED IsImageSupported;\r
89 EDKII_PECOFF_IMAGE_EMULATOR_REGISTER_IMAGE RegisterImage;\r
90 EDKII_PECOFF_IMAGE_EMULATOR_UNREGISTER_IMAGE UnregisterImage;\r
91\r
92 // Protocol version implemented by the emulator\r
93 UINT32 Version;\r
94 // The machine type implemented by the emulator\r
95 UINT16 MachineType;\r
96} EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL;\r
97\r
1436aea4 98extern EFI_GUID gEdkiiPeCoffImageEmulatorProtocolGuid;\r
f72f8177
AB
99\r
100#endif\r