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