]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Describes the protocol interface to the EBC interpreter.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials \r | |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef __EFI_EBC_PROTOCOL_H__\r | |
16 | #define __EFI_EBC_PROTOCOL_H__\r | |
17 | \r | |
18 | #define EFI_EBC_INTERPRETER_PROTOCOL_GUID \\r | |
19 | { \\r | |
20 | 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \\r | |
21 | }\r | |
22 | \r | |
23 | ///\r | |
24 | /// Protocol Guid Name defined in spec.\r | |
25 | ///\r | |
26 | #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID\r | |
27 | \r | |
28 | ///\r | |
29 | /// Define for forward reference.\r | |
30 | ///\r | |
31 | typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;\r | |
32 | \r | |
33 | /**\r | |
34 | Creates a thunk for an EBC entry point, returning the address of the thunk.\r | |
35 | \r | |
36 | A PE32+ EBC image, like any other PE32+ image, contains an optional header that specifies the\r | |
37 | entry point for image execution. However, for EBC images, this is the entry point of EBC\r | |
38 | instructions, so is not directly executable by the native processor. Therefore, when an EBC image is\r | |
39 | loaded, the loader must call this service to get a pointer to native code (thunk) that can be executed,\r | |
40 | which will invoke the interpreter to begin execution at the original EBC entry point.\r | |
41 | \r | |
42 | @param This A pointer to the EFI_EBC_PROTOCOL instance.\r | |
43 | @param ImageHandle Handle of image for which the thunk is being created.\r | |
44 | @param EbcEntryPoint Address of the actual EBC entry point or protocol service the thunk should call.\r | |
45 | @param Thunk Returned pointer to a thunk created.\r | |
46 | \r | |
47 | @retval EFI_SUCCESS The function completed successfully.\r | |
48 | @retval EFI_INVALID_PARAMETER Image entry point is not 2-byte aligned.\r | |
49 | @retval EFI_OUT_OF_RESOURCES Memory could not be allocated for the thunk.\r | |
50 | **/\r | |
51 | typedef\r | |
52 | EFI_STATUS\r | |
53 | (EFIAPI *EFI_EBC_CREATE_THUNK)(\r | |
54 | IN EFI_EBC_PROTOCOL *This,\r | |
55 | IN EFI_HANDLE ImageHandle,\r | |
56 | IN VOID *EbcEntryPoint,\r | |
57 | OUT VOID **Thunk\r | |
58 | );\r | |
59 | \r | |
60 | /**\r | |
61 | Called prior to unloading an EBC image from memory.\r | |
62 | \r | |
63 | This function is called after an EBC image has exited, but before the image is actually unloaded. It\r | |
64 | is intended to provide the interpreter with the opportunity to perform any cleanup that may be\r | |
65 | necessary as a result of loading and executing the image.\r | |
66 | \r | |
67 | @param This A pointer to the EFI_EBC_PROTOCOL instance.\r | |
68 | @param ImageHandle Image handle of the EBC image that is being unloaded from memory.\r | |
69 | \r | |
70 | @retval EFI_SUCCESS The function completed successfully.\r | |
71 | @retval EFI_INVALID_PARAMETER Image handle is not recognized as belonging \r | |
72 | to an EBC image that has been executed.\r | |
73 | **/\r | |
74 | typedef\r | |
75 | EFI_STATUS\r | |
76 | (EFIAPI *EFI_EBC_UNLOAD_IMAGE)(\r | |
77 | IN EFI_EBC_PROTOCOL *This,\r | |
78 | IN EFI_HANDLE ImageHandle\r | |
79 | );\r | |
80 | \r | |
81 | /**\r | |
82 | This is the prototype for the Flush callback routine. A pointer to a routine \r | |
83 | of this type is passed to the EBC EFI_EBC_REGISTER_ICACHE_FLUSH protocol service.\r | |
84 | \r | |
85 | @param Start The beginning physical address to flush from the processor's instruction cache.\r | |
86 | @param Length The number of bytes to flush from the processor's instruction cache.\r | |
87 | \r | |
88 | @retval EFI_SUCCESS The function completed successfully.\r | |
89 | \r | |
90 | **/\r | |
91 | typedef\r | |
92 | EFI_STATUS\r | |
93 | (EFIAPI *EBC_ICACHE_FLUSH)(\r | |
94 | IN EFI_PHYSICAL_ADDRESS Start,\r | |
95 | IN UINT64 Length\r | |
96 | );\r | |
97 | \r | |
98 | /**\r | |
99 | Registers a callback function that the EBC interpreter calls to flush \r | |
100 | the processor instruction cache following creation of thunks.\r | |
101 | \r | |
102 | @param This A pointer to the EFI_EBC_PROTOCOL instance.\r | |
103 | @param Flush Pointer to a function of type EBC_ICACH_FLUSH.\r | |
104 | \r | |
105 | @retval EFI_SUCCESS The function completed successfully.\r | |
106 | \r | |
107 | **/\r | |
108 | typedef\r | |
109 | EFI_STATUS\r | |
110 | (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(\r | |
111 | IN EFI_EBC_PROTOCOL *This,\r | |
112 | IN EBC_ICACHE_FLUSH Flush\r | |
113 | );\r | |
114 | \r | |
115 | /**\r | |
116 | Called to get the version of the interpreter.\r | |
117 | \r | |
118 | This function is called to get the version of the loaded EBC interpreter. The value and format of the\r | |
119 | returned version is identical to that returned by the EBC BREAK 1 instruction.\r | |
120 | \r | |
121 | @param This A pointer to the EFI_EBC_PROTOCOL instance. \r | |
122 | @param Version Pointer to where to store the returned version of the interpreter.\r | |
123 | \r | |
124 | @retval EFI_SUCCESS The function completed successfully.\r | |
125 | @retval EFI_INVALID_PARAMETER Version pointer is NULL.\r | |
126 | \r | |
127 | **/\r | |
128 | typedef\r | |
129 | EFI_STATUS\r | |
130 | (EFIAPI *EFI_EBC_GET_VERSION)(\r | |
131 | IN EFI_EBC_PROTOCOL *This,\r | |
132 | IN OUT UINT64 *Version\r | |
133 | );\r | |
134 | \r | |
135 | ///\r | |
136 | /// The EFI EBC protocol provides services to load and execute EBC images, which will typically be\r | |
137 | /// loaded into option ROMs. The image loader will load the EBC image, perform standard relocations,\r | |
138 | /// and invoke the CreateThunk() service to create a thunk for the EBC image's entry point. The\r | |
139 | /// image can then be run using the standard EFI start image services.\r | |
140 | ///\r | |
141 | struct _EFI_EBC_PROTOCOL {\r | |
142 | EFI_EBC_CREATE_THUNK CreateThunk;\r | |
143 | EFI_EBC_UNLOAD_IMAGE UnloadImage;\r | |
144 | EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;\r | |
145 | EFI_EBC_GET_VERSION GetVersion;\r | |
146 | };\r | |
147 | \r | |
148 | //\r | |
149 | // Extern the global EBC protocol GUID\r | |
150 | //\r | |
151 | extern EFI_GUID gEfiEbcProtocolGuid;\r | |
152 | \r | |
153 | #endif\r |