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