TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuGdt.h
Go to the documentation of this file.
1
10#ifndef _CPU_GDT_H_
11#define _CPU_GDT_H_
12
13//
14// Local structure definitions
15//
16
17#pragma pack (1)
18
19//
20// Global Descriptor Entry structures
21//
22
23typedef struct _GDT_ENTRY {
24 UINT16 Limit15_0;
25 UINT16 Base15_0;
26 UINT8 Base23_16;
27 UINT8 Type;
28 UINT8 Limit19_16_and_flags;
29 UINT8 Base31_24;
30} GDT_ENTRY;
31
32typedef
33 struct _GDT_ENTRIES {
34 GDT_ENTRY Null;
35 GDT_ENTRY Linear;
36 GDT_ENTRY LinearCode;
37 GDT_ENTRY SysData;
38 GDT_ENTRY SysCode;
39 GDT_ENTRY SysCode16;
40 GDT_ENTRY LinearData64;
41 GDT_ENTRY LinearCode64;
42 GDT_ENTRY Spare5;
44
45#pragma pack ()
46
47#define NULL_SEL OFFSET_OF (GDT_ENTRIES, Null)
48#define LINEAR_SEL OFFSET_OF (GDT_ENTRIES, Linear)
49#define LINEAR_CODE_SEL OFFSET_OF (GDT_ENTRIES, LinearCode)
50#define SYS_DATA_SEL OFFSET_OF (GDT_ENTRIES, SysData)
51#define SYS_CODE_SEL OFFSET_OF (GDT_ENTRIES, SysCode)
52#define SYS_CODE16_SEL OFFSET_OF (GDT_ENTRIES, SysCode16)
53#define LINEAR_DATA64_SEL OFFSET_OF (GDT_ENTRIES, LinearData64)
54#define LINEAR_CODE64_SEL OFFSET_OF (GDT_ENTRIES, LinearCode64)
55#define SPARE5_SEL OFFSET_OF (GDT_ENTRIES, Spare5)
56
57#if defined (MDE_CPU_IA32)
58#define CPU_CODE_SEL LINEAR_CODE_SEL
59#define CPU_DATA_SEL LINEAR_SEL
60#elif defined (MDE_CPU_X64)
61#define CPU_CODE_SEL LINEAR_CODE64_SEL
62#define CPU_DATA_SEL LINEAR_DATA64_SEL
63#else
64 #error CPU type not supported for CPU GDT initialization!
65#endif
66
67#endif // _CPU_GDT_H_