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 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "ScriptExecute.h"
19 // INTERRUPT_GATE_DESCRIPTOR and SetIdtEntry () are used to setup IDT to do debug
26 UINT16 SegmentSelector
;
29 } INTERRUPT_GATE_DESCRIPTOR
;
31 #define INTERRUPT_GATE_ATTRIBUTE 0x8e00
35 Set a IDT entry for interrupt vector 3 for debug purpose.
37 @param AcpiS3Context a pointer to a structure of ACPI_S3_CONTEXT
42 IN ACPI_S3_CONTEXT
*AcpiS3Context
45 INTERRUPT_GATE_DESCRIPTOR
*IdtEntry
;
46 IA32_DESCRIPTOR
*IdtDescriptor
;
50 // Restore IDT for debug
52 IdtDescriptor
= (IA32_DESCRIPTOR
*) (UINTN
) (AcpiS3Context
->IdtrProfile
);
53 IdtEntry
= (INTERRUPT_GATE_DESCRIPTOR
*)(IdtDescriptor
->Base
+ (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR
)));
54 S3DebugBuffer
= (UINTN
) (AcpiS3Context
->S3DebugBufferAddress
);
56 IdtEntry
->OffsetLow
= (UINT16
)S3DebugBuffer
;
57 IdtEntry
->SegmentSelector
= (UINT16
)AsmReadCs ();
58 IdtEntry
->Attributes
= (UINT16
)INTERRUPT_GATE_ATTRIBUTE
;
59 IdtEntry
->OffsetHigh
= (UINT16
)(S3DebugBuffer
>> 16);
61 AsmWriteIdtr (IdtDescriptor
);