1 /** @file
2   Prototypes for the EBC Debugger hooks.
3 
4   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5   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_DEBUGGER_HOOK_H_
16 #define _EFI_EBC_DEBUGGER_HOOK_H_
17 
18 #include <Uefi.h>
19 
20 #include <Protocol/DebugSupport.h>
21 #include <Protocol/EbcVmTest.h>
22 
23 /**
24   The VM interpreter calls this function when an exception is detected.
25 
26   @param  ExceptionType          Specifies the processor exception detected.
27   @param  ExceptionFlags         Specifies the exception context.
28   @param  VmPtr                  Pointer to a VM context for passing info to the
29                                  EFI debugger.
30 
31   @retval EFI_SUCCESS            This function completed successfully.
32 
33 **/
34 EFI_STATUS
35 EbcDebugSignalException (
36   IN EFI_EXCEPTION_TYPE                   ExceptionType,
37   IN EXCEPTION_FLAGS                      ExceptionFlags,
38   IN VM_CONTEXT                           *VmPtr
39   );
40 
41 /**
42 
43   The hook in InitializeEbcDriver.
44 
45   @param Handle           - The EbcDebugProtocol handle.
46   @param EbcDebugProtocol - The EbcDebugProtocol interface.
47 
48 **/
49 VOID
50 EbcDebuggerHookInit (
51   IN EFI_HANDLE                  Handle,
52   IN EFI_DEBUG_SUPPORT_PROTOCOL  *EbcDebugProtocol
53   );
54 
55 /**
56 
57 The hook in UnloadImage for EBC Interpreter.
58 
59 **/
60 VOID
61 EbcDebuggerHookUnload (
62   VOID
63   );
64 
65 /**
66 
67   The hook in EbcUnloadImage.
68   Currently do nothing here.
69 
70   @param  Handle          The EbcImage handle.
71 
72 **/
73 VOID
74 EbcDebuggerHookEbcUnloadImage (
75   IN EFI_HANDLE                  Handle
76   );
77 
78 
79 /**
80 
81   Hooks in EbcSupport.c
82 
83   @param  VmPtr - pointer to VM context.
84 
85 **/
86 VOID
87 EbcDebuggerHookExecuteEbcImageEntryPoint (
88   IN VM_CONTEXT *VmPtr
89   );
90 
91 /**
92 
93   The hook in ExecuteEbcImageEntryPoint.
94 
95   @param  VmPtr - pointer to VM context.
96 
97 **/
98 VOID
99 EbcDebuggerHookEbcInterpret (
100   IN VM_CONTEXT *VmPtr
101   );
102 
103 
104 /**
105   The hook in EbcExecute, before ExecuteFunction.
106 
107   @param  VmPtr - pointer to VM context.
108 
109 **/
110 VOID
111 EbcDebuggerHookExecuteStart (
112   IN VM_CONTEXT *VmPtr
113   );
114 
115 /**
116   The hook in EbcExecute, after ExecuteFunction.
117 
118   @param  VmPtr - pointer to VM context.
119 
120 **/
121 VOID
122 EbcDebuggerHookExecuteEnd (
123   IN VM_CONTEXT *VmPtr
124   );
125 
126 /**
127   The hook in ExecuteCALL, before move IP.
128 
129   @param  VmPtr - pointer to VM context.
130 
131 **/
132 VOID
133 EbcDebuggerHookCALLStart (
134   IN VM_CONTEXT *VmPtr
135   );
136 
137 /**
138 
139   The hook in ExecuteCALL, after move IP.
140 
141   @param  VmPtr - pointer to VM context.
142 
143 **/
144 VOID
145 EbcDebuggerHookCALLEnd (
146   IN VM_CONTEXT *VmPtr
147   );
148 
149 /**
150 
151   The hook in ExecuteCALL, before call EbcLLCALLEX.
152 
153   @param  VmPtr - pointer to VM context.
154 
155 **/
156 VOID
157 EbcDebuggerHookCALLEXStart (
158   IN VM_CONTEXT *VmPtr
159   );
160 
161 /**
162 
163   The hook in ExecuteCALL, after call EbcLLCALLEX.
164 
165   @param  VmPtr - pointer to VM context.
166 
167 **/
168 VOID
169 EbcDebuggerHookCALLEXEnd (
170   IN VM_CONTEXT *VmPtr
171   );
172 
173 /**
174 
175   The hook in ExecuteRET, before move IP.
176 
177   @param  VmPtr - pointer to VM context.
178 
179 **/
180 VOID
181 EbcDebuggerHookRETStart (
182   IN VM_CONTEXT *VmPtr
183   );
184 
185 /**
186 
187   The hook in ExecuteRET, after move IP.
188   It will record trace information.
189 
190   @param  VmPtr - pointer to VM context.
191 
192 **/
193 VOID
194 EbcDebuggerHookRETEnd (
195   IN VM_CONTEXT *VmPtr
196   );
197 
198 
199 /**
200 
201   The hook in ExecuteJMP, before move IP.
202 
203   @param  VmPtr - pointer to VM context.
204 
205 **/
206 VOID
207 EbcDebuggerHookJMPStart (
208   IN VM_CONTEXT *VmPtr
209   );
210 
211 /**
212 
213   The hook in ExecuteJMP, after move IP.
214 
215   @param  VmPtr - pointer to VM context.
216 
217 **/
218 VOID
219 EbcDebuggerHookJMPEnd (
220   IN VM_CONTEXT *VmPtr
221   );
222 
223 /**
224 
225   The hook in ExecuteJMP8, before move IP.
226 
227   @param  VmPtr - pointer to VM context.
228 
229 **/
230 VOID
231 EbcDebuggerHookJMP8Start (
232   IN VM_CONTEXT *VmPtr
233   );
234 
235 /**
236 
237   The hook in ExecuteJMP8, after move IP..
238 
239   @param  VmPtr - pointer to VM context.
240 
241 **/
242 VOID
243 EbcDebuggerHookJMP8End (
244   IN VM_CONTEXT *VmPtr
245   );
246 
247 #endif
248