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
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 IsaIa32
27 #define FF_FXSR (1 << 24)
29 typedef UINT64 DESCRIPTOR
;
33 VOID (*OrigVector
) (VOID
);
35 VOID (*StubEntry
) (VOID
);
36 VOID (*RegisteredCallback
) ();
39 extern EFI_SYSTEM_CONTEXT SystemContext
;
40 extern UINT8 InterruptEntryStub
[];
41 extern UINT32 StubSize
;
42 extern VOID (*OrigVector
) (VOID
);
74 Check whether FXSTOR is supported
96 Return the physical address of IDTR
104 The physical address of IDTR
111 DESCRIPTOR
* DestDesc
,
112 VOID (*Vector
) (VOID
)
118 Encodes an IDT descriptor with the given physical address
122 DestDesc - The IDT descriptor address
123 Vector - The interrupt vector entry
140 Programs interrupt flag to the requested state and returns previous
145 NewState - New interrupt status
155 plInitializeDebugSupportDriver (
161 Initializes driver's handler registration database.
163 This code executes in boot services context.
170 EFI_UNSUPPORTED - if IA32 processor does not support FXSTOR/FXRSTOR instructions,
171 the context save will fail, so these processor's are not supported.
172 EFI_OUT_OF_RESOURCES - not resource to finish initialization
179 plUnloadDebugSupportDriver (
180 IN EFI_HANDLE ImageHandle
185 This is the callback that is written to the LoadedImage protocol instance
186 on the image handle. It uninstalls all registered handlers and frees all entry
189 This code executes in boot services context.
192 ImageHandle - The image handle of the unload handler
196 EFI_SUCCESS - always return success
202 // DebugSupport protocol member functions
206 GetMaximumProcessorIndex (
207 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
208 OUT UINTN
*MaxProcessorIndex
212 Routine Description: This is a DebugSupport protocol member function.
215 This - The DebugSupport instance
216 MaxProcessorIndex - The maximuim supported processor index
219 Always returns EFI_SUCCESS with *MaxProcessorIndex set to 0
226 RegisterPeriodicCallback (
227 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
228 IN UINTN ProcessorIndex
,
229 IN EFI_PERIODIC_CALLBACK PeriodicCallback
233 Routine Description: This is a DebugSupport protocol member function.
236 This - The DebugSupport instance
237 ProcessorIndex - Which processor the callback applies to.
238 PeriodicCallback - Callback function
243 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
244 no handler registered for it
245 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
247 Other possible return values are passed through from UnHookEntry and HookEntry.
254 RegisterExceptionCallback (
255 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
256 IN UINTN ProcessorIndex
,
257 IN EFI_EXCEPTION_CALLBACK NewCallback
,
258 IN EFI_EXCEPTION_TYPE ExceptionType
263 This is a DebugSupport protocol member function.
265 This code executes in boot services context.
268 This - The DebugSupport instance
269 ProcessorIndex - Which processor the callback applies to.
270 NewCallback - Callback function
271 ExceptionType - Which exception to hook
276 EFI_INVALID_PARAMETER - requested uninstalling a handler from a vector that has
277 no handler registered for it
278 EFI_ALREADY_STARTED - requested install to a vector that already has a handler registered.
280 Other possible return values are passed through from UnHookEntry and HookEntry.
287 InvalidateInstructionCache (
288 IN EFI_DEBUG_SUPPORT_PROTOCOL
*This
,
289 IN UINTN ProcessorIndex
,
296 This is a DebugSupport protocol member function.
297 Calls assembly routine to flush cache.
300 This - The DebugSupport instance
301 ProcessorIndex - Which processor the callback applies to.
302 Start - Physical base of the memory range to be invalidated
303 Length - mininum number of bytes in instruction cache to invalidate
307 EFI_SUCCESS - always return success