/** @file\r
- X64 specific debug support macros, typedefs and prototypes.\r
+ X64 specific debug support macros.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation \r
All rights reserved. This program and the accompanying materials \r
#ifndef _PLDEBUG_SUPPORT_H_\r
#define _PLDEBUG_SUPPORT_H_\r
\r
+#include "Ia32/DebugSupport.h"\r
\r
-#include <Uefi.h>\r
-\r
-#include <Protocol/DebugSupport.h>\r
-#include <Protocol/LoadedImage.h>\r
-\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/BaseLib.h>\r
-\r
-#include <Library/PcdLib.h>\r
-#define NUM_IDT_ENTRIES 0x78\r
-#define SYSTEM_TIMER_VECTOR 0x68\r
-#define VECTOR_ENTRY_PAGES 1\r
-#define COPY_DESCRIPTOR(Dest, Src) CopyMem ((Dest), (Src), sizeof (DESCRIPTOR))\r
-#define READ_IDT(Vector, Dest) COPY_DESCRIPTOR ((Dest), &((GetIdtr ())[(Vector)]))\r
-#define WRITE_IDT(Vector, Src) COPY_DESCRIPTOR (&((GetIdtr ())[(Vector)]), (Src))\r
-#define COMPARE_DESCRIPTOR(Desc1, Desc2) CompareMem ((Desc1), (Desc2), sizeof (DESCRIPTOR))\r
#define EFI_ISA IsaX64\r
-#define FF_FXSR (1 << 24)\r
-\r
-typedef struct {\r
- UINT64 Low;\r
- UINT64 High;\r
-} DESCRIPTOR;\r
-\r
-typedef\r
-VOID\r
-(*DEBUG_PROC) (\r
- VOID\r
- );\r
-\r
-typedef struct {\r
- DESCRIPTOR OrigDesc;\r
- DEBUG_PROC OrigVector;\r
- DESCRIPTOR NewDesc;\r
- DEBUG_PROC StubEntry;\r
- VOID (*RegisteredCallback) ();\r
-} IDT_ENTRY;\r
-\r
-extern EFI_SYSTEM_CONTEXT SystemContext;\r
-extern UINT8 InterruptEntryStub[];\r
-extern UINT32 StubSize;\r
-extern VOID (*OrigVector) (VOID);\r
-\r
-/**\r
- Generic IDT entry.\r
-\r
-**/\r
-VOID\r
-CommonIdtEntry (\r
- VOID\r
- );\r
-\r
-/**\r
- Check whether FXSTOR is supported\r
-\r
- @retval TRUE FXSTOR is supported.\r
- @retval FALSE FXSTOR is not supported.\r
-\r
-**/\r
-BOOLEAN\r
-FxStorSupport (\r
- VOID\r
- );\r
-\r
-/**\r
- Return the physical address of IDTR.\r
-\r
- @return The physical address of IDTR.\r
-\r
-**/\r
-DESCRIPTOR *\r
-GetIdtr (\r
- VOID\r
- );\r
-\r
-/**\r
- Encodes an IDT descriptor with the given physical address.\r
-\r
- @param DestDesc The IDT descriptor address.\r
- @param Vecotr The interrupt vector entry.\r
-\r
-**/\r
-VOID\r
-Vect2Desc (\r
- DESCRIPTOR * DestDesc,\r
- VOID (*Vector) (VOID)\r
- );\r
-\r
-/**\r
- Programs interrupt flag to the requested state and returns previous\r
- state.\r
-\r
- @param NewState New interrupt status.\r
-\r
- @retval TRUE Old interrupt status is TRUE.\r
- @retval FALSE Old interrupt status is FALSE\r
-\r
-**/\r
-BOOLEAN\r
-WriteInterruptFlag (\r
- BOOLEAN NewState\r
- );\r
-\r
-/**\r
- Initializes driver's handler registration databas. \r
- \r
- This code executes in boot services context\r
- Must be public because it's referenced from DebugSupport.c\r
-\r
- @retval EFI_UNSUPPORTED If x64 processor does not support FXSTOR/FXRSTOR instructions,\r
- the context save will fail, so these processor's are not supported.\r
- @retval EFI_OUT_OF_RESOURCES Fails to allocate memory.\r
- @retval EFI_SUCCESS Initializes successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-PlInitializeDebugSupportDriver (\r
- VOID\r
- );\r
-\r
-/**\r
- This is the callback that is written to the LoadedImage protocol instance\r
- on the image handle. It uninstalls all registered handlers and frees all entry\r
- stub memory.\r
-\r
- @param ImageHandle The firmware allocated handle for the EFI image.\r
-\r
- @retval EFI_SUCCESS Always.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PlUnloadDebugSupportDriver (\r
- IN EFI_HANDLE ImageHandle\r
- );\r
-\r
-/**\r
- This is a DebugSupport protocol member function, hard\r
- coded to support only 1 processor for now.\r
-\r
- @param This The DebugSupport instance\r
- @param MaxProcessorIndex The maximuim supported processor index\r
-\r
- @retval EFI_SUCCESS Always returned with **MaxProcessorIndex set to 0.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetMaximumProcessorIndex (\r
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
- OUT UINTN *MaxProcessorIndex\r
- );\r
-\r
-/**\r
- DebugSupport protocol member function.\r
-\r
- @param This The DebugSupport instance\r
- @param ProcessorIndex Which processor the callback applies to.\r
- @param PeriodicCallback Callback function\r
-\r
- @retval EFI_SUCCESS Indicates the callback was registered.\r
- @retval others Callback was not registered.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RegisterPeriodicCallback (\r
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
- IN UINTN ProcessorIndex,\r
- IN EFI_PERIODIC_CALLBACK PeriodicCallback\r
- );\r
-\r
-/**\r
- DebugSupport protocol member function.\r
-\r
- This code executes in boot services context.\r
-\r
- @param This The DebugSupport instance\r
- @param ProcessorIndex Which processor the callback applies to.\r
- @param NewCallback Callback function\r
- @param ExceptionType Which exception to hook\r
-\r
- @retval EFI_SUCCESS Indicates the callback was registered.\r
- @retval others Callback was not registered.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-RegisterExceptionCallback (\r
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
- IN UINTN ProcessorIndex,\r
- IN EFI_EXCEPTION_CALLBACK NewCallback,\r
- IN EFI_EXCEPTION_TYPE ExceptionType\r
- );\r
-\r
-/**\r
- DebugSupport protocol member function. Calls assembly routine to flush cache.\r
-\r
- @param This The DebugSupport instance\r
- @param ProcessorIndex Which processor the callback applies to.\r
- @param Start Physical base of the memory range to be invalidated\r
- @param Length mininum number of bytes in instruction cache to invalidate\r
-\r
- @retval EFI_SUCCESS Always returned.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InvalidateInstructionCache (\r
- IN EFI_DEBUG_SUPPORT_PROTOCOL *This,\r
- IN UINTN ProcessorIndex,\r
- IN VOID *Start,\r
- IN UINT64 Length\r
- );\r
\r
#endif\r