NOVA
Stripped down NOVA kernel for the OSY course
descriptor.h
1 /*
2  * Descriptor
3  *
4  * Copyright (C) 2009-2011 Udo Steinberg <udo@hypervisor.org>
5  * Economic rights: Technische Universitaet Dresden (Germany)
6  *
7  * This file is part of the NOVA microhypervisor.
8  *
9  * NOVA is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  *
13  * NOVA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License version 2 for more details.
17  */
18 
19 #pragma once
20 
21 #include "compiler.h"
22 #include "types.h"
23 
25 {
26  protected:
27  enum Granularity
28  {
29  BYTES = 0u << 23,
30  PAGES = 1u << 23,
31  };
32 
33  enum Size
34  {
35  BIT_16 = 0u << 22,
36  BIT_32 = 1u << 22
37  };
38 
39  enum Type
40  {
41  SYS_LDT = 2u << 8,
42  SYS_TASK_GATE = 5u << 8,
43  SYS_TSS = 9u << 8,
44  SYS_CALL_GATE = 12u << 8,
45  SYS_INTR_GATE = 14u << 8,
46  SYS_TRAP_GATE = 15u << 8,
47 
48  DATA_R = 16u << 8,
49  DATA_RA = 17u << 8,
50  DATA_RW = 18u << 8,
51  DATA_RWA = 19u << 8,
52  DATA_DOWN_R = 20u << 8,
53  DATA_DOWN_RA = 21u << 8,
54  DATA_DOWN_RW = 22u << 8,
55  DATA_DOWN_RWA = 23u << 8,
56 
57  CODE_X = 24u << 8,
58  CODE_XA = 25u << 8,
59  CODE_XR = 26u << 8,
60  CODE_XRA = 27u << 8,
61  CODE_CONF_X = 28u << 8,
62  CODE_CONF_XA = 29u << 8,
63  CODE_CONF_XR = 30u << 8,
64  CODE_CONF_XRA = 31u << 8
65  };
66 };
67 
68 #pragma pack(1)
70 {
71  private:
72  uint16 limit;
73  mword base;
74 
75  public:
76  ALWAYS_INLINE
77  inline Pseudo_descriptor (uint16 l, mword b) : limit (l), base (b) {}
78 };
79 #pragma pack()
Definition: descriptor.h:25
Definition: descriptor.h:70