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