878ddf1f |
1 | /** @file\r |
2 | Describes the protocol interface to the EBC interpreter.\r |
3 | \r |
4 | Copyright (c) 2006, Intel Corporation \r |
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 |
13 | Module Name: Ebc.h\r |
14 | \r |
15 | **/\r |
16 | \r |
17 | #ifndef __EFI_EBC_PROTOCOL_H__\r |
18 | #define __EFI_EBC_PROTOCOL_H__\r |
19 | \r |
20 | #define EFI_EBC_INTERPRETER_PROTOCOL_GUID \\r |
21 | { \\r |
22 | 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7 } \\r |
23 | }\r |
24 | \r |
25 | //\r |
26 | // Protocol Guid Name defined in spec.\r |
27 | //\r |
28 | #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID\r |
29 | \r |
30 | //\r |
31 | // Define for forward reference.\r |
32 | //\r |
33 | typedef struct _EFI_EBC_PROTOCOL EFI_EBC_PROTOCOL;\r |
34 | \r |
35 | /**\r |
36 | Create a thunk for an image entry point. In short, given the physical address\r |
37 | of the entry point for a loaded image, create a thunk that does some \r |
38 | fixup of arguments (and perform any other necessary overhead) and then\r |
39 | calls the original entry point. The caller can then use the returned pointer\r |
40 | to the created thunk as the new entry point to image.\r |
41 | \r |
42 | @param This protocol instance pointer\r |
43 | @param ImageHandle handle to the image. The EBC interpreter may use this to keep\r |
44 | track of any resource allocations performed in loading and\r |
45 | executing the image.\r |
46 | @param EbcEntryPoint the entry point for the image (as defined in the file header)\r |
47 | @param Thunk pointer to thunk pointer where the address of the created\r |
48 | thunk is returned.\r |
49 | \r |
50 | @return Standard EFI_STATUS\r |
51 | \r |
52 | **/\r |
53 | typedef\r |
54 | EFI_STATUS\r |
55 | (EFIAPI *EFI_EBC_CREATE_THUNK) (\r |
56 | IN EFI_EBC_PROTOCOL *This,\r |
57 | IN EFI_HANDLE ImageHandle,\r |
58 | IN VOID *EbcEntryPoint,\r |
59 | OUT VOID **Thunk\r |
60 | );\r |
61 | \r |
62 | /**\r |
63 | Perform any cleanup necessary when an image is unloaded. Basically it gives\r |
64 | the EBC interpreter the chance to free up any resources allocated during\r |
65 | load and execution of an EBC image.\r |
66 | \r |
67 | @param This protocol instance pointer\r |
68 | @param ImageHandle the handle of the image being unloaded.\r |
69 | \r |
70 | @return Standard EFI_STATUS.\r |
71 | \r |
72 | **/\r |
73 | typedef\r |
74 | EFI_STATUS\r |
75 | (EFIAPI *EFI_EBC_UNLOAD_IMAGE) (\r |
76 | IN EFI_EBC_PROTOCOL *This,\r |
77 | IN EFI_HANDLE ImageHandle\r |
78 | );\r |
79 | \r |
80 | /**\r |
81 | The I-Cache-flush registration service takes a pointer to a function to\r |
82 | call to flush the I-Cache. Here's the prototype for that function pointer.\r |
83 | \r |
84 | @param Start physical start address of CPU instruction cache to flush.\r |
85 | @param Length how many bytes to flush of the instruction cache.\r |
86 | \r |
87 | @return Standard EFI_STATUS.\r |
88 | \r |
89 | **/\r |
90 | typedef\r |
91 | EFI_STATUS\r |
92 | (EFIAPI *EBC_ICACHE_FLUSH) (\r |
93 | IN EFI_PHYSICAL_ADDRESS Start,\r |
94 | IN UINT64 Length\r |
95 | );\r |
96 | \r |
97 | /**\r |
98 | This routine is called by the core firmware to provide the EBC driver with\r |
99 | a function to call to flush the CPU's instruction cache following creation\r |
100 | of a thunk. It is not required.\r |
101 | \r |
102 | @param This protocol instance pointer\r |
103 | @param Flush pointer to the function to call to flush the CPU instruction\r |
104 | cache.\r |
105 | \r |
106 | @return Standard EFI_STATUS.\r |
107 | \r |
108 | **/\r |
109 | typedef\r |
110 | EFI_STATUS\r |
111 | (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH) (\r |
112 | IN EFI_EBC_PROTOCOL *This,\r |
113 | IN EBC_ICACHE_FLUSH Flush\r |
114 | );\r |
115 | \r |
116 | /**\r |
117 | This routine can be called to get the VM revision. It returns the same\r |
118 | value as the EBC BREAK 1 instruction returns.\r |
119 | \r |
120 | @param This protocol instance pointer\r |
121 | @param Version pointer to where to return the VM version\r |
122 | \r |
123 | @return Standard EFI_STATUS.\r |
124 | \r |
125 | **/\r |
126 | typedef\r |
127 | EFI_STATUS\r |
128 | (EFIAPI *EFI_EBC_GET_VERSION) (\r |
129 | IN EFI_EBC_PROTOCOL *This,\r |
130 | IN OUT UINT64 *Version\r |
131 | );\r |
132 | \r |
133 | //\r |
134 | // Prototype for the actual EBC protocol interface\r |
135 | //\r |
136 | struct _EFI_EBC_PROTOCOL {\r |
137 | EFI_EBC_CREATE_THUNK CreateThunk;\r |
138 | EFI_EBC_UNLOAD_IMAGE UnloadImage;\r |
139 | EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;\r |
140 | EFI_EBC_GET_VERSION GetVersion;\r |
141 | };\r |
142 | \r |
143 | //\r |
144 | // Extern the global EBC protocol GUID\r |
145 | //\r |
146 | extern EFI_GUID gEfiEbcProtocolGuid;\r |
147 | \r |
148 | #endif\r |