9#include <PeCoffExtraActionLib.h>
23 IN IA32_DESCRIPTOR *IdtDescriptor,
27 IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
28 UINTN InterruptHandler;
30 IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor->Base;
31 if (IdtEntry ==
NULL) {
35 InterruptHandler = IdtEntry[InterruptType].Bits.OffsetLow +
36 (IdtEntry[InterruptType].Bits.OffsetHigh << 16);
37 if ((InterruptHandler >=
sizeof (UINT32)) && (*(UINT32 *)(InterruptHandler -
sizeof (UINT32)) == AGENT_HANDLER_SIGNATURE)) {
53 IN IA32_DESCRIPTOR *IdtDescriptor,
54 OUT IA32_IDT_GATE_DESCRIPTOR *SavedIdtEntry
57 IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
59 UINTN InterruptHandler;
61 IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor->Base;
62 CopyMem (SavedIdtEntry, &IdtEntry[1],
sizeof (IA32_IDT_GATE_DESCRIPTOR));
69 InterruptHandler = (
UINTN)&AsmInterruptHandle;
70 IdtEntry[1].Bits.OffsetLow = (UINT16)(
UINTN)InterruptHandler;
71 IdtEntry[1].Bits.OffsetHigh = (UINT16)((
UINTN)InterruptHandler >> 16);
72 IdtEntry[1].Bits.Selector = CodeSegment;
73 IdtEntry[1].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
85 IN IA32_DESCRIPTOR *IdtDescriptor,
86 IN IA32_IDT_GATE_DESCRIPTOR *RestoredIdtEntry
89 IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
91 IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor->Base;
92 CopyMem (&IdtEntry[1], RestoredIdtEntry,
sizeof (IA32_IDT_GATE_DESCRIPTOR));
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
UINT16 EFIAPI AsmReadCs(VOID)
VOID SaveAndUpdateIdtEntry1(IN IA32_DESCRIPTOR *IdtDescriptor, OUT IA32_IDT_GATE_DESCRIPTOR *SavedIdtEntry)
VOID RestoreIdtEntry1(IN IA32_DESCRIPTOR *IdtDescriptor, IN IA32_IDT_GATE_DESCRIPTOR *RestoredIdtEntry)
BOOLEAN CheckDebugAgentHandler(IN IA32_DESCRIPTOR *IdtDescriptor, IN UINTN InterruptType)