1 /** @file
2   PE/Coff Extra Action library instances, it will report image debug info.
3 
4   Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5   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.
9 
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.
12 
13 **/
14 
15 #ifndef _PE_COFF_EXTRA_ACTION_LIB_H_
16 #define _PE_COFF_EXTRA_ACTION_LIB_H_
17 
18 #include <Base.h>
19 #include <Library/PeCoffExtraActionLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseLib.h>
22 #include <Library/IoLib.h>
23 #include <Library/PcdLib.h>
24 #include <Library/BaseMemoryLib.h>
25 
26 #include <ImageDebugSupport.h>
27 
28 #define DEBUG_LOAD_IMAGE_METHOD_IO_HW_BREAKPOINT    1
29 #define DEBUG_LOAD_IMAGE_METHOD_SOFT_INT3           2
30 
31 #define IO_HW_BREAKPOINT_VECTOR_NUM                 1
32 #define SOFT_INT_VECTOR_NUM                         3
33 
34 extern UINTN  AsmInterruptHandle;
35 
36 /**
37   Read IDT entry to check if IDT entries are setup by Debug Agent.
38 
39   @param[in]  IdtDescriptor      Pointer to IDT Descriptor.
40   @param[in]  InterruptType      Interrupt type.
41 
42   @retval  TRUE     IDT entries were setup by Debug Agent.
43   @retval  FALSE    IDT entries were not setuo by Debug Agent.
44 
45 **/
46 BOOLEAN
47 CheckDebugAgentHandler (
48   IN  IA32_DESCRIPTOR            *IdtDescriptor,
49   IN  UINTN                      InterruptType
50   );
51 
52 /**
53   Save IDT entry for INT1 and update it.
54 
55   @param[in]  IdtDescriptor      Pointer to IDT Descriptor.
56   @param[out] SavedIdtEntry      Original IDT entry returned.
57 
58 **/
59 VOID
60 SaveAndUpdateIdtEntry1 (
61   IN  IA32_DESCRIPTOR            *IdtDescriptor,
62   OUT IA32_IDT_GATE_DESCRIPTOR   *SavedIdtEntry
63   );
64 
65 /**
66   Restore IDT entry for INT1.
67 
68   @param[in]  IdtDescriptor      Pointer to IDT Descriptor.
69   @param[in]  RestoredIdtEntry   IDT entry to be restored.
70 
71 **/
72 VOID
73 RestoreIdtEntry1 (
74   IN  IA32_DESCRIPTOR            *IdtDescriptor,
75   IN  IA32_IDT_GATE_DESCRIPTOR   *RestoredIdtEntry
76   );
77 
78 #endif
79 
80