2 IA32 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
21 #include <Protocol/DebugSupport.h>
22 #include <Protocol/LoadedImage.h>
24 #include <Library/DebugLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/BaseMemoryLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/BaseLib.h>
30 #include <Library/PcdLib.h>
32 #define NUM_IDT_ENTRIES 0x78
33 #define SYSTEM_TIMER_VECTOR 0x68
34 #define VECTOR_ENTRY_PAGES 1
35 #define CopyDescriptor(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))
36 #define ZeroDescriptor(Dest) CopyDescriptor ((Dest), &NullDesc)
37 #define ReadIdt(Vector, Dest) CopyDescriptor ((Dest), &((GetIdtr ())[(Vector)]))
38 #define WriteIdt(Vector, Src) CopyDescriptor (&((GetIdtr ())[(Vector)]), (Src))
39 #define CompareDescriptor(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))
40 #define EFI_ISA IsaIa32
41 #define FF_FXSR (1 << 24)
43 typedef UINT64 DESCRIPTOR
;
54 DEBUG_PROC OrigVector
;
57 VOID (*RegisteredCallback
) ();
60 extern EFI_SYSTEM_CONTEXT SystemContext
;
61 extern UINT8 InterruptEntryStub
[];
62 extern UINT32 StubSize
;
63 extern VOID (*OrigVector
) (VOID
);
95 Check whether FXSTOR is supported
104 FALSE - not supported
117 Return the physical address of IDTR
125 The physical address of IDTR
132 DESCRIPTOR
* DestDesc
,
133 VOID (*Vector
) (VOID
)
139 Encodes an IDT descriptor with the given physical address
143 DestDesc - The IDT descriptor address
144 Vector - The interrupt vector entry
161 Programs interrupt flag to the requested state and returns previous
166 NewState - New interrupt status
176 plInitializeDebugSupportDriver (
182 Initializes driver's handler registration database.
184 This code executes in boot services context.
191 EFI_UNSUPPORTED - if IA32 processor does not support FXSTOR/FXRSTOR instructions,
192 the context save will fail, so these processor's are not supported.
193 EFI_OUT_OF_RESOURCES - not resource to finish initialization
200 plUnloadDebugSupportDriver (
201 IN EFI_HANDLE ImageHandle
206 This is the callback that is written to the LoadedImage protocol instance
207 on the image handle. It uninstalls all registered handlers and frees all entry
210 This code executes in boot services context.
213 ImageHandle - The image handle of the unload handler
217 EFI_SUCCESS - always return success
223 // DebugSupport protocol member functions
227 GetMaximumProcessorIndex (
228 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
229 OUT UINTN
*MaxProcessorIndex
233 Routine Description: This is a DebugSupport protocol member function.
236 This - The DebugSupport instance
237 MaxProcessorIndex - The maximuim supported processor index
240 Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
247 RegisterPeriodicCallback (
248 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
249 IN UINTN ProcessorIndex
,
250 IN EFI_PERIODIC_CALLBACK PeriodicCallback
254 Routine Description: This is a DebugSupport protocol member function.
257 This - The DebugSupport instance
258 ProcessorIndex - Which processor the callback applies to.
259 PeriodicCallback - Callback function
264 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
265 no handler registered for it
266 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
268 Other possible return values are passed through from UnHookEntry and HookEntry.
275 RegisterExceptionCallback (
276 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
277 IN UINTN ProcessorIndex
,
278 IN EFI_EXCEPTION_CALLBACK NewCallback
,
279 IN EFI_EXCEPTION_TYPE ExceptionType
284 This is a DebugSupport protocol member function.
286 This code executes in boot services context.
289 This - The DebugSupport instance
290 ProcessorIndex - Which processor the callback applies to.
291 NewCallback - Callback function
292 ExceptionType - Which exception to hook
297 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
298 no handler registered for it
299 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
301 Other possible return values are passed through from UnHookEntry and HookEntry.
308 InvalidateInstructionCache (
309 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
310 IN UINTN ProcessorIndex
,
317 This is a DebugSupport protocol member function.
318 Calls assembly routine to flush cache.
321 This - The DebugSupport instance
322 ProcessorIndex - Which processor the callback applies to.
323 Start - Physical base of the memory range to be invalidated
324 Length - mininum number of bytes in instruction cache to invalidate
328 EFI_SUCCESS - always return success