]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c
Fix build fail.
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / BootScriptExecutorDxe / X64 / SetIdtEntry.c
CommitLineData
be46cd5f 1/** @file\r
2 Set a IDT entry for debug purpose\r
3\r
4 Set a IDT entry for interrupt vector 3 for debug purpose for x64 platform\r
5\r
6Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
7\r
8This program and the accompanying materials\r
9are licensed and made available under the terms and conditions of the BSD License\r
10which accompanies this distribution. The full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17#include "ScriptExecute.h"\r
18//\r
19// INTERRUPT_GATE_DESCRIPTOR and SetIdtEntry () are used to setup IDT to do debug\r
20//\r
21\r
22#pragma pack(1)\r
23\r
24typedef struct {\r
25 UINT16 Offset15To0;\r
26 UINT16 SegmentSelector;\r
27 UINT16 Attributes;\r
28 UINT16 Offset31To16;\r
29 UINT32 Offset63To32;\r
30 UINT32 Reserved;\r
31} INTERRUPT_GATE_DESCRIPTOR;\r
32\r
33#define INTERRUPT_GATE_ATTRIBUTE 0x8e00\r
34\r
35#pragma pack()\r
36/**\r
37 Set a IDT entry for interrupt vector 3 for debug purpose.\r
38\r
39 @param AcpiS3Context a pointer to a structure of ACPI_S3_CONTEXT\r
40\r
41**/\r
42VOID\r
43SetIdtEntry (\r
44 IN ACPI_S3_CONTEXT *AcpiS3Context\r
45 )\r
46{\r
47 INTERRUPT_GATE_DESCRIPTOR *IdtEntry;\r
48 IA32_DESCRIPTOR *IdtDescriptor;\r
49 UINTN S3DebugBuffer;\r
50\r
51 //\r
52 // Restore IDT for debug\r
53 //\r
54 IdtDescriptor = (IA32_DESCRIPTOR *) (UINTN) (AcpiS3Context->IdtrProfile);\r
55 IdtEntry = (INTERRUPT_GATE_DESCRIPTOR *)(IdtDescriptor->Base + (3 * sizeof (INTERRUPT_GATE_DESCRIPTOR)));\r
56 S3DebugBuffer = (UINTN) (AcpiS3Context->S3DebugBufferAddress);\r
57\r
58 IdtEntry->Offset15To0 = (UINT16)S3DebugBuffer;\r
59 IdtEntry->SegmentSelector = (UINT16)AsmReadCs ();;\r
60 IdtEntry->Attributes = (UINT16)INTERRUPT_GATE_ATTRIBUTE;\r
61 IdtEntry->Offset31To16 = (UINT16)(S3DebugBuffer >> 16);\r
62 IdtEntry->Offset63To32 = (UINT32)(S3DebugBuffer >> 32);\r
63 IdtEntry->Reserved = 0;\r
64\r
65 AsmWriteIdtr (IdtDescriptor);\r
66}\r
67\r