The Pedigree Project  0.1
x86/gdt.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef KERNEL_PROCESSOR_X86_GDT_H
21 #define KERNEL_PROCESSOR_X86_GDT_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/processor/types.h"
25 
31 {
32  public:
35  inline static X86GdtManager &instance()
36  {
37  return m_Instance;
38  }
39 
43  void initialise(size_t processorCount) INITIALISATION_ONLY;
48 
50  void setTlsBase(uintptr_t base);
51 
52  private:
63 
71  size_t index, uint32_t base, uint32_t limit, uint8_t flags,
72  uint8_t flags2);
76  void setTssDescriptor(size_t index, uint32_t base) INITIALISATION_ONLY;
77 
81  void
83 
86  {
88  uint16_t limit0;
90  uint16_t base0;
92  uint8_t base1;
94  uint8_t flags;
96  uint8_t flags_limit1;
98  uint8_t base2;
99  } PACKED;
100 
105 
108 };
109 
112 #endif
static X86GdtManager m_Instance
Definition: x86/gdt.h:107
static void initialiseProcessor() INITIALISATION_ONLY
Definition: x86/gdt.cc:86
X86GdtManager & operator=(const X86GdtManager &)
void setTssDescriptor(size_t index, uint32_t base) INITIALISATION_ONLY
Definition: x86/gdt.cc:141
void setTlsBase(uintptr_t base)
Definition: x86/gdt.cc:119
void initialiseTss(struct X86TaskStateSegment *pTss) INITIALISATION_ONLY
Definition: x86/gdt.cc:145
void initialise(size_t processorCount) INITIALISATION_ONLY
Definition: x86/gdt.cc:30
X86GdtManager() INITIALISATION_ONLY
Definition: x86/gdt.cc:112
void initialiseDoubleFaultTss(X86TaskStateSegment *pTss) INITIALISATION_ONLY
Definition: x86/gdt.cc:158
size_t m_DescriptorCount
Definition: x86/gdt.h:104
static X86GdtManager & instance()
Definition: x86/gdt.h:35
void setSegmentDescriptor(size_t index, uint32_t base, uint32_t limit, uint8_t flags, uint8_t flags2)
Definition: x86/gdt.cc:131
segment_descriptor * m_Gdt
Definition: x86/gdt.h:102