20 IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
21 UINTN InterruptHandler;
22 IA32_DESCRIPTOR IdtDescriptor;
34 IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
36 for (Index = 0; Index < 20; Index++) {
37 if (((
PcdGet32 (PcdExceptionsIgnoredByDebugger) & ~(BIT1 | BIT3)) & (1 << Index)) != 0) {
44 InterruptHandler = (
UINTN)&Exception0Handle + Index * ExceptionStubHeaderSize;
45 IdtEntry[Index].Bits.OffsetLow = (UINT16)(
UINTN)InterruptHandler;
46 IdtEntry[Index].Bits.OffsetHigh = (UINT16)((
UINTN)InterruptHandler >> 16);
47 IdtEntry[Index].Bits.Selector = CodeSegment;
48 IdtEntry[Index].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
51 InterruptHandler = (
UINTN)&TimerInterruptHandle;
52 IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetLow = (UINT16)(
UINTN)InterruptHandler;
53 IdtEntry[DEBUG_TIMER_VECTOR].Bits.OffsetHigh = (UINT16)((
UINTN)InterruptHandler >> 16);
54 IdtEntry[DEBUG_TIMER_VECTOR].Bits.Selector = CodeSegment;
55 IdtEntry[DEBUG_TIMER_VECTOR].Bits.GateType = IA32_IDT_GATE_TYPE_INTERRUPT_32;
62 if ((RegEdx & BIT2) != 0) {
80 IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
81 IA32_DESCRIPTOR IdtDescriptor;
84 IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
86 return (VOID *)(((
UINTN)IdtEntry[ExceptionNum].Bits.OffsetLow) |
87 (((
UINTN)IdtEntry[ExceptionNum].Bits.OffsetHigh) << 16));
100 IN VOID *ExceptionHandler
103 IA32_IDT_GATE_DESCRIPTOR *IdtEntry;
104 IA32_DESCRIPTOR IdtDescriptor;
107 IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
109 IdtEntry[ExceptionNum].Bits.OffsetLow = (UINT16)(
UINTN)ExceptionHandler;
110 IdtEntry[ExceptionNum].Bits.OffsetHigh = (UINT16)((
UINTN)ExceptionHandler >> 16);
VOID * GetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum)
VOID InitializeDebugIdt(VOID)
VOID SetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum, IN VOID *ExceptionHandler)
UINTN EFIAPI AsmWriteCr4(UINTN Cr4)
UINT16 EFIAPI AsmReadCs(VOID)
UINTN EFIAPI AsmReadCr4(VOID)
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
#define PcdGet32(TokenName)
VOID EFIAPI AsmReadIdtr(OUT IA32_DESCRIPTOR *Idtr)