]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/Ebc.h
Reviewed the code comments in the Include/Protocol directory for typos, grammar issue...
[mirror_edk2.git] / MdePkg / Include / Protocol / Ebc.h
CommitLineData
d1f95000 1/** @file\r
2 Describes the protocol interface to the EBC interpreter.\r
3\r
4ca9b6c4 4 Copyright (c) 2006 - 2008, Intel Corporation \r
d1f95000 5 All rights reserved. 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
d1f95000 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
99e8ed21 23///\r
24/// Protocol Guid Name defined in spec.\r
25///\r
d1f95000 26#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID\r
27\r
99e8ed21 28///\r
29/// Define for forward reference.\r
30///\r
d1f95000 31typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;\r
32\r
33/**\r
4ca9b6c4
LG
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
630b4187 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
4ca9b6c4
LG
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
630b4187 45 @param Thunk Returned pointer to a created thunk.\r
4ca9b6c4
LG
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
d1f95000 50**/\r
51typedef\r
52EFI_STATUS\r
8b13229b 53(EFIAPI *EFI_EBC_CREATE_THUNK)(\r
d1f95000 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
4ca9b6c4 61 Called prior to unloading an EBC image from memory.\r
d1f95000 62\r
4ca9b6c4
LG
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
d1f95000 66\r
4ca9b6c4
LG
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
d1f95000 69\r
4ca9b6c4
LG
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
d1f95000 73**/\r
74typedef\r
75EFI_STATUS\r
8b13229b 76(EFIAPI *EFI_EBC_UNLOAD_IMAGE)(\r
d1f95000 77 IN EFI_EBC_PROTOCOL *This,\r
78 IN EFI_HANDLE ImageHandle\r
79 );\r
80\r
81/**\r
4ca9b6c4
LG
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
d1f95000 84\r
4ca9b6c4
LG
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
d1f95000 87\r
4ca9b6c4 88 @retval EFI_SUCCESS The function completed successfully.\r
d1f95000 89\r
90**/\r
91typedef\r
92EFI_STATUS\r
8b13229b 93(EFIAPI *EBC_ICACHE_FLUSH)(\r
d1f95000 94 IN EFI_PHYSICAL_ADDRESS Start,\r
95 IN UINT64 Length\r
96 );\r
97\r
98/**\r
74fec708
LG
99 Registers a callback function that the EBC interpreter calls to flush \r
100 the processor instruction cache following creation of thunks.\r
d1f95000 101\r
4ca9b6c4
LG
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
d1f95000 104\r
4ca9b6c4 105 @retval EFI_SUCCESS The function completed successfully.\r
d1f95000 106\r
107**/\r
108typedef\r
109EFI_STATUS\r
8b13229b 110(EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(\r
d1f95000 111 IN EFI_EBC_PROTOCOL *This,\r
112 IN EBC_ICACHE_FLUSH Flush\r
113 );\r
114\r
115/**\r
4ca9b6c4
LG
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
d1f95000 120\r
4ca9b6c4 121 @param This A pointer to the EFI_EBC_PROTOCOL instance. \r
630b4187 122 @param Version Pointer to the location to store the returned version of the interpreter.\r
d1f95000 123\r
4ca9b6c4
LG
124 @retval EFI_SUCCESS The function completed successfully.\r
125 @retval EFI_INVALID_PARAMETER Version pointer is NULL.\r
d1f95000 126\r
127**/\r
128typedef\r
129EFI_STATUS\r
8b13229b 130(EFIAPI *EFI_EBC_GET_VERSION)(\r
d1f95000 131 IN EFI_EBC_PROTOCOL *This,\r
132 IN OUT UINT64 *Version\r
133 );\r
134\r
44717a39 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
d1f95000 141struct _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
151extern EFI_GUID gEfiEbcProtocolGuid;\r
152\r
153#endif\r