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) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include "ScriptExecute.h"
14 Set a IDT entry for interrupt vector 3 for debug purpose.
16 @param AcpiS3Context a pointer to a structure of ACPI_S3_CONTEXT
21 IN ACPI_S3_CONTEXT
*AcpiS3Context
24 IA32_IDT_GATE_DESCRIPTOR
*IdtEntry
;
25 IA32_DESCRIPTOR
*IdtDescriptor
;
30 // Restore IDT for debug
32 IdtDescriptor
= (IA32_DESCRIPTOR
*)(UINTN
)(AcpiS3Context
->IdtrProfile
);
33 AsmWriteIdtr (IdtDescriptor
);
36 // Setup the default CPU exception handlers
38 Status
= InitializeCpuExceptionHandlers (NULL
);
39 ASSERT_EFI_ERROR (Status
);
43 // Update IDT entry INT3 if the instruction is valid in it
45 S3DebugBuffer
= (UINTN
)(AcpiS3Context
->S3DebugBufferAddress
);
46 if (*(UINTN
*)S3DebugBuffer
!= (UINTN
)-1) {
47 IdtEntry
= (IA32_IDT_GATE_DESCRIPTOR
*)(IdtDescriptor
->Base
+ (3 * sizeof (IA32_IDT_GATE_DESCRIPTOR
)));
48 IdtEntry
->Bits
.OffsetLow
= (UINT16
)S3DebugBuffer
;
49 IdtEntry
->Bits
.Selector
= (UINT16
)AsmReadCs ();
50 IdtEntry
->Bits
.Reserved_0
= 0;
51 IdtEntry
->Bits
.GateType
= IA32_IDT_GATE_TYPE_INTERRUPT_32
;
52 IdtEntry
->Bits
.OffsetHigh
= (UINT16
)(S3DebugBuffer
>> 16);