The Pedigree Project  0.1
x86_common/ProcessorInformation.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_COMMON_PROCESSORINFORMATION_H
21 #define KERNEL_PROCESSOR_X86_COMMON_PROCESSORINFORMATION_H
22 
23 #define _PROCESSOR_INFORMATION_ONLY_WANT_PROCESSORID
24 
25 #include "pedigree/kernel/compiler.h"
26 #include "pedigree/kernel/processor/ProcessorInformation.h"
27 #include "pedigree/kernel/processor/types.h"
28 
31 class Thread;
32 
38 {
39  friend class Processor;
40  friend class Multiprocessor;
41 
42  public:
43 #if defined(X86)
44  typedef struct X86TaskStateSegment TaskStateSegment;
45 #else
46  typedef struct X64TaskStateSegment TaskStateSegment;
47 #endif
48 
51  VirtualAddressSpace &getVirtualAddressSpace() const;
54  void setVirtualAddressSpace(VirtualAddressSpace &virtualAddressSpace);
55 
58  void setTssSelector(uint16_t TssSelector);
61  void setTss(void *Tss);
64  uint16_t getTssSelector() const;
67  void *getTss() const;
69  uint16_t getTlsSelector();
71  void setTlsSelector(uint16_t tls);
72 
73  uintptr_t getKernelStack() const;
74  void setKernelStack(uintptr_t stack);
75  Thread *getCurrentThread() const;
76  void setCurrentThread(Thread *pThread);
77 
78  PerProcessorScheduler &getScheduler();
79 
80  protected:
83  X86CommonProcessorInformation(ProcessorId processorId, uint8_t apicId = 0);
86 
87  void setIds(ProcessorId processorId, uint8_t apicId = 0);
88 
89  private:
99  operator=(const X86CommonProcessorInformation &);
100 
104  uint16_t m_TssSelector;
106  TaskStateSegment *m_Tss;
110  uint8_t m_LocalApicId;
116  uint16_t m_TlsSelector;
117 };
118 
121 #endif
The exception was caused by a hardware task switch.
Definition: Processor.h:80
size_t ProcessorId
Definition: Thread.h:54