2 X64 specific debug support macros, typedefs and prototypes.
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
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.
15 #ifndef _PLDEBUG_SUPPORT_H
16 #define _PLDEBUG_SUPPORT_H
18 #define NUM_IDT_ENTRIES 0x78
19 #define SYSTEM_TIMER_VECTOR 0x68
20 #define VECTOR_ENTRY_PAGES 1
21 #define CopyDescriptor(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))
22 #define ZeroDescriptor(Dest) CopyDescriptor ((Dest), &NullDesc)
23 #define ReadIdt(Vector, Dest) CopyDescriptor ((Dest), &((GetIdtr ())[(Vector)]))
24 #define WriteIdt(Vector, Src) CopyDescriptor (&((GetIdtr ())[(Vector)]), (Src))
25 #define CompareDescriptor(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))
26 #define EFI_ISA IsaX64
27 #define FF_FXSR (1 << 24)
43 DEBUG_PROC OrigVector
;
46 VOID (*RegisteredCallback
) ();
49 extern EFI_SYSTEM_CONTEXT SystemContext
;
50 extern UINT8 InterruptEntryStub
[];
51 extern UINT32 StubSize
;
52 extern VOID (*OrigVector
) (VOID
);
84 Check whether FXSTOR is supported
106 Return the physical address of IDTR
114 The physical address of IDTR
121 DESCRIPTOR
* DestDesc
,
122 VOID (*Vector
) (VOID
)
128 Encodes an IDT descriptor with the given physical address
132 DestDesc - The IDT descriptor address
133 Vector - The interrupt vector entry
150 Programs interrupt flag to the requested state and returns previous
155 NewState - New interrupt status
165 plInitializeDebugSupportDriver (
171 Initializes driver's handler registration database.
173 This code executes in boot services context.
180 EFI_UNSUPPORTED - if X64 processor does not support FXSTOR/FXRSTOR instructions,
181 the context save will fail, so these processor's are not supported.
182 EFI_OUT_OF_RESOURCES - not resource to finish initialization
189 plUnloadDebugSupportDriver (
190 IN EFI_HANDLE ImageHandle
195 This is the callback that is written to the LoadedImage protocol instance
196 on the image handle. It uninstalls all registered handlers and frees all entry
199 This code executes in boot services context.
202 ImageHandle - The image handle of the unload handler
206 EFI_SUCCESS - always return success
212 // DebugSupport protocol member functions
216 GetMaximumProcessorIndex (
217 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
218 OUT UINTN
*MaxProcessorIndex
222 Routine Description: This is a DebugSupport protocol member function.
225 This - The DebugSupport instance
226 MaxProcessorIndex - The maximuim supported processor index
229 Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
236 RegisterPeriodicCallback (
237 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
238 IN UINTN ProcessorIndex
,
239 IN EFI_PERIODIC_CALLBACK PeriodicCallback
243 Routine Description: This is a DebugSupport protocol member function.
246 This - The DebugSupport instance
247 ProcessorIndex - Which processor the callback applies to.
248 PeriodicCallback - Callback function
253 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
254 no handler registered for it
255 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
257 Other possible return values are passed through from UnHookEntry and HookEntry.
264 RegisterExceptionCallback (
265 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
266 IN UINTN ProcessorIndex
,
267 IN EFI_EXCEPTION_CALLBACK NewCallback
,
268 IN EFI_EXCEPTION_TYPE ExceptionType
273 This is a DebugSupport protocol member function.
275 This code executes in boot services context.
278 This - The DebugSupport instance
279 ProcessorIndex - Which processor the callback applies to.
280 NewCallback - Callback function
281 ExceptionType - Which exception to hook
286 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
287 no handler registered for it
288 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
290 Other possible return values are passed through from UnHookEntry and HookEntry.
297 InvalidateInstructionCache (
298 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
299 IN UINTN ProcessorIndex
,
306 This is a DebugSupport protocol member function.
307 Calls assembly routine to flush cache.
310 This - The DebugSupport instance
311 ProcessorIndex - Which processor the callback applies to.
312 Start - Physical base of the memory range to be invalidated
313 Length - mininum number of bytes in instruction cache to invalidate
317 EFI_SUCCESS - always return success