UefiCpuPkg/CpuDxe: Enable protection for newly added page table
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuGdt.h
CommitLineData
a1e8986d
JJ
1/** @file\r
2 C based implemention of IA32 interrupt handling only\r
3 requiring a minimal assembly interrupt entry point.\r
4\r
0d4c1db8 5 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
a1e8986d
JJ
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _CPU_GDT_H_\r
17#define _CPU_GDT_H_\r
18\r
19//\r
20// Local structure definitions\r
21//\r
22\r
23#pragma pack (1)\r
24\r
25//\r
26// Global Descriptor Entry structures\r
27//\r
28\r
29typedef struct _GDT_ENTRY {\r
30 UINT16 Limit15_0;\r
31 UINT16 Base15_0;\r
32 UINT8 Base23_16;\r
33 UINT8 Type;\r
34 UINT8 Limit19_16_and_flags;\r
35 UINT8 Base31_24;\r
36} GDT_ENTRY;\r
37\r
38typedef\r
39struct _GDT_ENTRIES {\r
40 GDT_ENTRY Null;\r
41 GDT_ENTRY Linear;\r
42 GDT_ENTRY LinearCode;\r
43 GDT_ENTRY SysData;\r
44 GDT_ENTRY SysCode;\r
a1e8986d 45 GDT_ENTRY Spare4;\r
0d4c1db8
MK
46 GDT_ENTRY LinearData64;\r
47 GDT_ENTRY LinearCode64;\r
a1e8986d
JJ
48 GDT_ENTRY Spare5;\r
49} GDT_ENTRIES;\r
50\r
51#pragma pack ()\r
52\r
53#define NULL_SEL OFFSET_OF (GDT_ENTRIES, Null)\r
54#define LINEAR_SEL OFFSET_OF (GDT_ENTRIES, Linear)\r
55#define LINEAR_CODE_SEL OFFSET_OF (GDT_ENTRIES, LinearCode)\r
56#define SYS_DATA_SEL OFFSET_OF (GDT_ENTRIES, SysData)\r
57#define SYS_CODE_SEL OFFSET_OF (GDT_ENTRIES, SysCode)\r
a1e8986d 58#define SPARE4_SEL OFFSET_OF (GDT_ENTRIES, Spare4)\r
0d4c1db8
MK
59#define LINEAR_DATA64_SEL OFFSET_OF (GDT_ENTRIES, LinearData64)\r
60#define LINEAR_CODE64_SEL OFFSET_OF (GDT_ENTRIES, LinearCode64)\r
a1e8986d
JJ
61#define SPARE5_SEL OFFSET_OF (GDT_ENTRIES, Spare5)\r
62\r
63#if defined (MDE_CPU_IA32)\r
64#define CPU_CODE_SEL LINEAR_CODE_SEL\r
65#define CPU_DATA_SEL LINEAR_SEL\r
66#elif defined (MDE_CPU_X64)\r
67#define CPU_CODE_SEL LINEAR_CODE64_SEL\r
0d4c1db8 68#define CPU_DATA_SEL LINEAR_DATA64_SEL\r
a1e8986d
JJ
69#else\r
70#error CPU type not supported for CPU GDT initialization!\r
71#endif\r
72\r
73#endif // _CPU_GDT_H_\r
74\r