]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DebugSupportDxe/x64/plDebugSupport.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / x64 / plDebugSupport.h
CommitLineData
c1f23d63 1/**@file\r
2 X64 specific debug support macros, typedefs and prototypes.\r
3\r
4Copyright (c) 2006, Intel Corporation \r
5All rights reserved. This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php \r
9 \r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13**/\r
14\r
15#ifndef _PLDEBUG_SUPPORT_H\r
16#define _PLDEBUG_SUPPORT_H\r
17\r
ed7748fe 18\r
60c93673 19#include <Uefi.h>\r
ed7748fe 20\r
c1f23d63 21#include <Protocol/DebugSupport.h>\r
22#include <Protocol/LoadedImage.h>\r
ed7748fe 23\r
c1f23d63 24#include <Library/DebugLib.h>\r
25#include <Library/UefiDriverEntryPoint.h>\r
26#include <Library/BaseMemoryLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/BaseLib.h>\r
30\r
31#include <Library/PcdLib.h>\r
32#define NUM_IDT_ENTRIES 0x78\r
33#define SYSTEM_TIMER_VECTOR 0x68\r
34#define VECTOR_ENTRY_PAGES 1\r
35#define CopyDescriptor(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))\r
36#define ZeroDescriptor(Dest) CopyDescriptor ((Dest), &NullDesc)\r
37#define ReadIdt(Vector, Dest) CopyDescriptor ((Dest), &((GetIdtr ())[(Vector)]))\r
38#define WriteIdt(Vector, Src) CopyDescriptor (&((GetIdtr ())[(Vector)]), (Src))\r
39#define CompareDescriptor(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))\r
40#define EFI_ISA IsaX64\r
41#define FF_FXSR (1 << 24)\r
42\r
43typedef struct {\r
44 UINT64 Low;\r
45 UINT64 High;\r
46} DESCRIPTOR;\r
47\r
48typedef\r
49VOID\r
50(*DEBUG_PROC) (\r
51 VOID\r
ed66e1bc 52 );\r
c1f23d63 53\r
54typedef struct {\r
55 DESCRIPTOR OrigDesc;\r
56 DEBUG_PROC OrigVector;\r
57 DESCRIPTOR NewDesc;\r
58 DEBUG_PROC StubEntry;\r
59 VOID (*RegisteredCallback) ();\r
60} IDT_ENTRY;\r
61\r
62extern EFI_SYSTEM_CONTEXT SystemContext;\r
63extern UINT8 InterruptEntryStub[];\r
64extern UINT32 StubSize;\r
65extern VOID (*OrigVector) (VOID);\r
66\r
67VOID\r
68CommonIdtEntry (\r
69 VOID\r
70 )\r
71/*++\r
72\r
73Routine Description:\r
74\r
75 Generic IDT entry\r
76\r
77Arguments:\r
78\r
79 None\r
80\r
81Returns:\r
82\r
83 None\r
84\r
85--*/\r
86;\r
87\r
88\r
89BOOLEAN\r
90FxStorSupport (\r
91 VOID\r
92 )\r
93/*++\r
94\r
95Routine Description:\r
96\r
97 Check whether FXSTOR is supported\r
98\r
99Arguments:\r
100\r
101 None\r
102\r
103Returns:\r
104\r
105 TRUE - supported\r
106 FALSE - not supported\r
107\r
108--*/\r
109;\r
110\r
111DESCRIPTOR *\r
112GetIdtr (\r
113 VOID\r
114 )\r
115/*++\r
116\r
117Routine Description:\r
118\r
119 Return the physical address of IDTR\r
120\r
121Arguments:\r
122\r
123 None\r
124\r
125Returns:\r
126\r
127 The physical address of IDTR\r
128\r
129--*/\r
130;\r
131\r
132VOID\r
133Vect2Desc (\r
134 DESCRIPTOR * DestDesc,\r
135 VOID (*Vector) (VOID)\r
136 )\r
137/*++\r
138\r
139Routine Description:\r
140\r
141 Encodes an IDT descriptor with the given physical address\r
142\r
143Arguments:\r
144\r
145 DestDesc - The IDT descriptor address\r
146 Vector - The interrupt vector entry\r
147\r
148Returns:\r
149\r
150 None\r
151\r
152--*/\r
153;\r
154\r
155BOOLEAN\r
156WriteInterruptFlag (\r
157 BOOLEAN NewState\r
158 )\r
159/*++\r
160\r
161Routine Description:\r
162\r
163 Programs interrupt flag to the requested state and returns previous\r
164 state.\r
165\r
166Arguments:\r
167\r
168 NewState - New interrupt status\r
169\r
170Returns:\r
171\r
172 Old interrupt status\r
173\r
174--*/\r
175;\r
176\r
177EFI_STATUS\r
178plInitializeDebugSupportDriver (\r
179 VOID\r
180 )\r
181/*++\r
182\r
183Routine Description:\r
184 Initializes driver's handler registration database.\r
185\r
186 This code executes in boot services context.\r
187\r
188Arguments:\r
189 None\r
190\r
191Returns:\r
192 EFI_SUCCESS\r
193 EFI_UNSUPPORTED - if X64 processor does not support FXSTOR/FXRSTOR instructions,\r
194 the context save will fail, so these processor's are not supported.\r
195 EFI_OUT_OF_RESOURCES - not resource to finish initialization\r
196\r
197--*/\r
198;\r
199\r
200EFI_STATUS\r
201EFIAPI\r
202plUnloadDebugSupportDriver (\r
203 IN EFI_HANDLE ImageHandle\r
204 )\r
205/*++\r
206\r
207Routine Description:\r
208 This is the callback that is written to the LoadedImage protocol instance\r
209 on the image handle. It uninstalls all registered handlers and frees all entry\r
210 stub memory.\r
211\r
212 This code executes in boot services context.\r
213\r
214Arguments:\r
215 ImageHandle - The image handle of the unload handler\r
216\r
217Returns:\r
218\r
219 EFI_SUCCESS - always return success\r
220\r
221--*/\r
222;\r
223\r
224//\r
225// DebugSupport protocol member functions\r
226//\r
227EFI_STATUS\r
228EFIAPI\r
229GetMaximumProcessorIndex (\r
230 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
231 OUT UINTN *MaxProcessorIndex\r
232 )\r
233/*++\r
234\r
235Routine Description: This is a DebugSupport protocol member function.\r
236\r
237Arguments:\r
238 This - The DebugSupport instance\r
239 MaxProcessorIndex - The maximuim supported processor index\r
240\r
241Returns:\r
242 Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0\r
243\r
244--*/\r
245;\r
246\r
247EFI_STATUS\r
248EFIAPI\r
249RegisterPeriodicCallback (\r
250 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
251 IN UINTN ProcessorIndex,\r
252 IN EFI_PERIODIC_CALLBACK PeriodicCallback\r
253 )\r
254/*++\r
255\r
256Routine Description: This is a DebugSupport protocol member function.\r
257\r
258Arguments:\r
259 This - The DebugSupport instance\r
260 ProcessorIndex - Which processor the callback applies to.\r
261 PeriodicCallback - Callback function\r
262\r
263Returns:\r
264\r
265 EFI_SUCCESS\r
266 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has\r
267 no handler registered for it\r
268 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.\r
269\r
270 Other possible return values are passed through from UnHookEntry and HookEntry.\r
271\r
272--*/\r
273;\r
274\r
275EFI_STATUS\r
276EFIAPI\r
277RegisterExceptionCallback (\r
278 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
279 IN UINTN ProcessorIndex,\r
280 IN EFI_EXCEPTION_CALLBACK NewCallback,\r
281 IN EFI_EXCEPTION_TYPE ExceptionType\r
282 )\r
283/*++\r
284\r
285Routine Description:\r
286 This is a DebugSupport protocol member function.\r
287\r
288 This code executes in boot services context.\r
289\r
290Arguments:\r
291 This - The DebugSupport instance\r
292 ProcessorIndex - Which processor the callback applies to.\r
293 NewCallback - Callback function\r
294 ExceptionType - Which exception to hook\r
295\r
296Returns:\r
297\r
298 EFI_SUCCESS\r
299 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has\r
300 no handler registered for it\r
301 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.\r
302\r
303 Other possible return values are passed through from UnHookEntry and HookEntry.\r
304\r
305--*/\r
306;\r
307\r
308EFI_STATUS\r
309EFIAPI\r
310InvalidateInstructionCache (\r
311 IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
312 IN UINTN ProcessorIndex,\r
313 IN VOID *Start,\r
314 IN UINT64 Length\r
315 )\r
316/*++\r
317\r
318Routine Description:\r
319 This is a DebugSupport protocol member function.\r
320 Calls assembly routine to flush cache.\r
321\r
322Arguments:\r
323 This - The DebugSupport instance\r
324 ProcessorIndex - Which processor the callback applies to.\r
325 Start - Physical base of the memory range to be invalidated\r
326 Length - mininum number of bytes in instruction cache to invalidate\r
327\r
328Returns:\r
329\r
330 EFI_SUCCESS - always return success\r
331\r
332--*/\r
333;\r
334\r
335#endif\r