1 /*++ 2 3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 Ebc.h 15 16 Abstract: 17 18 Describes the protocol interface to the EBC interpreter. 19 20 --*/ 21 22 #ifndef _EBC_H_ 23 #define _EBC_H_ 24 25 #define EFI_EBC_INTERPRETER_PROTOCOL_GUID \ 26 { \ 27 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7} \ 28 } 29 30 // 31 // Define for forward reference. 32 // 33 EFI_FORWARD_DECLARATION (EFI_EBC_PROTOCOL); 34 35 /*++ 36 37 Routine Description: 38 39 Create a thunk for an image entry point. In short, given the physical address 40 of the entry point for a loaded image, create a thunk that does some 41 fixup of arguments (and perform any other necessary overhead) and then 42 calls the original entry point. The caller can then use the returned pointer 43 to the created thunk as the new entry point to image. 44 45 Arguments: 46 47 This - protocol instance pointer 48 ImageHandle - handle to the image. The EBC interpreter may use this to keep 49 track of any resource allocations performed in loading and 50 executing the image. 51 EbcEntryPoint - the entry point for the image (as defined in the file header) 52 Thunk - pointer to thunk pointer where the address of the created 53 thunk is returned. 54 55 Returns: 56 57 Standard EFI_STATUS 58 59 --*/ 60 typedef 61 EFI_STATUS 62 (EFIAPI *EFI_EBC_CREATE_THUNK) ( 63 IN EFI_EBC_PROTOCOL * This, 64 IN EFI_HANDLE ImageHandle, 65 IN VOID *EbcEntryPoint, 66 OUT VOID **Thunk 67 ); 68 69 /*++ 70 71 Routine Description: 72 73 Perform any cleanup necessary when an image is unloaded. Basically it gives 74 the EBC interpreter the chance to free up any resources allocated during 75 load and execution of an EBC image. 76 77 Arguments: 78 79 This - protocol instance pointer 80 ImageHandle - the handle of the image being unloaded. 81 82 Returns: 83 84 Standard EFI_STATUS. 85 86 --*/ 87 typedef 88 EFI_STATUS 89 (EFIAPI *EFI_EBC_UNLOAD_IMAGE) ( 90 IN EFI_EBC_PROTOCOL * This, 91 IN EFI_HANDLE ImageHandle 92 ); 93 94 /*++ 95 96 Routine Description: 97 98 The I-Cache-flush registration service takes a pointer to a function to 99 call to flush the I-Cache. Here's the prototype for that function pointer. 100 101 Arguments: 102 103 Start - physical start address of CPU instruction cache to flush. 104 Length - how many bytes to flush of the instruction cache. 105 106 Returns: 107 108 Standard EFI_STATUS. 109 110 --*/ 111 typedef 112 EFI_STATUS 113 (EFIAPI *EBC_ICACHE_FLUSH) ( 114 IN EFI_PHYSICAL_ADDRESS Start, 115 IN UINT64 Length 116 ); 117 118 /*++ 119 120 Routine Description: 121 122 This routine is called by the core firmware to provide the EBC driver with 123 a function to call to flush the CPU's instruction cache following creation 124 of a thunk. It is not required. 125 126 Arguments: 127 128 This - protocol instance pointer 129 Flush - pointer to the function to call to flush the CPU instruction 130 cache. 131 132 Returns: 133 134 Standard EFI_STATUS. 135 136 --*/ 137 typedef 138 EFI_STATUS 139 (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH) ( 140 IN EFI_EBC_PROTOCOL * This, 141 IN EBC_ICACHE_FLUSH Flush 142 ); 143 144 /*++ 145 146 Routine Description: 147 148 This routine can be called to get the VM revision. It returns the same 149 value as the EBC BREAK 1 instruction returns. 150 151 Arguments: 152 153 This - protocol instance pointer 154 Version - pointer to where to return the VM version 155 156 Returns: 157 158 Standard EFI_STATUS. 159 160 --*/ 161 typedef 162 EFI_STATUS 163 (EFIAPI *EFI_EBC_GET_VERSION) ( 164 IN EFI_EBC_PROTOCOL * This, 165 IN OUT UINT64 *Version 166 ); 167 168 // 169 // Prototype for the actual EBC protocol interface 170 // 171 struct _EFI_EBC_PROTOCOL { 172 EFI_EBC_CREATE_THUNK CreateThunk; 173 EFI_EBC_UNLOAD_IMAGE UnloadImage; 174 EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush; 175 EFI_EBC_GET_VERSION GetVersion; 176 }; 177 178 // 179 // Extern the global EBC protocol GUID 180 // 181 extern EFI_GUID gEfiEbcProtocolGuid; 182 183 #endif 184