PeCoffExtraActionLib.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /** @file
  2. PE/Coff Extra Action library instances, it will report image debug info.
  3. Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _PE_COFF_EXTRA_ACTION_LIB_H_
  7. #define _PE_COFF_EXTRA_ACTION_LIB_H_
  8. #include <Base.h>
  9. #include <Library/PeCoffExtraActionLib.h>
  10. #include <Library/DebugLib.h>
  11. #include <Library/BaseLib.h>
  12. #include <Library/IoLib.h>
  13. #include <Library/PcdLib.h>
  14. #include <Library/BaseMemoryLib.h>
  15. #include <ImageDebugSupport.h>
  16. #define DEBUG_LOAD_IMAGE_METHOD_IO_HW_BREAKPOINT 1
  17. #define DEBUG_LOAD_IMAGE_METHOD_SOFT_INT3 2
  18. #define IO_HW_BREAKPOINT_VECTOR_NUM 1
  19. #define SOFT_INT_VECTOR_NUM 3
  20. extern UINTN AsmInterruptHandle;
  21. /**
  22. Read IDT entry to check if IDT entries are setup by Debug Agent.
  23. @param[in] IdtDescriptor Pointer to IDT Descriptor.
  24. @param[in] InterruptType Interrupt type.
  25. @retval TRUE IDT entries were setup by Debug Agent.
  26. @retval FALSE IDT entries were not setup by Debug Agent.
  27. **/
  28. BOOLEAN
  29. CheckDebugAgentHandler (
  30. IN IA32_DESCRIPTOR *IdtDescriptor,
  31. IN UINTN InterruptType
  32. );
  33. /**
  34. Save IDT entry for INT1 and update it.
  35. @param[in] IdtDescriptor Pointer to IDT Descriptor.
  36. @param[out] SavedIdtEntry Original IDT entry returned.
  37. **/
  38. VOID
  39. SaveAndUpdateIdtEntry1 (
  40. IN IA32_DESCRIPTOR *IdtDescriptor,
  41. OUT IA32_IDT_GATE_DESCRIPTOR *SavedIdtEntry
  42. );
  43. /**
  44. Restore IDT entry for INT1.
  45. @param[in] IdtDescriptor Pointer to IDT Descriptor.
  46. @param[in] RestoredIdtEntry IDT entry to be restored.
  47. **/
  48. VOID
  49. RestoreIdtEntry1 (
  50. IN IA32_DESCRIPTOR *IdtDescriptor,
  51. IN IA32_IDT_GATE_DESCRIPTOR *RestoredIdtEntry
  52. );
  53. #endif