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