2 Set a IDT entry for debug purpose
4 Set a IDT entry for interrupt vector 3 for debug purpose for IA32 platform
6 Copyright (c) 2013-2015 Intel Corporation.
8 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include "ScriptExecute.h"
13 // INTERRUPT_GATE_DESCRIPTOR and SetIdtEntry () are used to setup IDT to do debug
20 UINT16 SegmentSelector
;
23 } INTERRUPT_GATE_DESCRIPTOR
;
25 #define INTERRUPT_GATE_ATTRIBUTE 0x8e00
29 Set a IDT entry for interrupt vector 3 for debug purpose.
31 @param AcpiS3Context a pointer to a structure of ACPI_S3_CONTEXT
36 IN ACPI_S3_CONTEXT
*AcpiS3Context
39 INTERRUPT_GATE_DESCRIPTOR
*IdtEntry
;
40 IA32_DESCRIPTOR
*IdtDescriptor
;
44 // Restore IDT for debug
46 IdtDescriptor
= (IA32_DESCRIPTOR
*) (UINTN
) (AcpiS3Context
->IdtrProfile
);
47 IdtEntry
= (INTERRUPT_GATE_DESCRIPTOR
*)(IdtDescriptor
->Base
+ (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR
)));
48 S3DebugBuffer
= (UINTN
) (AcpiS3Context
->S3DebugBufferAddress
);
50 IdtEntry
->OffsetLow
= (UINT16
)S3DebugBuffer
;
51 IdtEntry
->SegmentSelector
= (UINT16
)AsmReadCs ();
52 IdtEntry
->Attributes
= (UINT16
)INTERRUPT_GATE_ATTRIBUTE
;
53 IdtEntry
->OffsetHigh
= (UINT16
)(S3DebugBuffer
>> 16);
55 AsmWriteIdtr (IdtDescriptor
);