The Pedigree Project  0.1
ppc_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_MIPS_COMMON_PROCESSORINFORMATION_H
21 #define KERNEL_PROCESSOR_MIPS_COMMON_PROCESSORINFORMATION_H
22 
23 #include "pedigree/kernel/process/Thread.h"
24 #include "pedigree/kernel/processor/VirtualAddressSpace.h"
25 #include "pedigree/kernel/processor/types.h"
26 
32 {
33  friend class Processor;
34 
35  public:
39  {
40  return *m_VirtualAddressSpace;
41  }
44  inline void setVirtualAddressSpace(VirtualAddressSpace &virtualAddressSpace)
45  {
46  m_VirtualAddressSpace = &virtualAddressSpace;
47  }
48 
49  inline uintptr_t getKernelStack() const;
50  inline void setKernelStack(uintptr_t stack);
51  inline Thread *getCurrentThread() const
52  {
53  return m_pCurrentThread;
54  }
55  inline void setCurrentThread(Thread *pThread)
56  {
57  m_pCurrentThread = pThread;
58  }
59 
60  protected:
64  : m_ProcessorId(processorId),
65  m_VirtualAddressSpace(&VirtualAddressSpace::getKernelAddressSpace()),
67  {
68  }
71  {
72  }
73 
74  private:
85 
92 };
93 
96 extern "C" uint32_t kernel_stack;
97 //
98 // Part of the implementation
99 //
100 uintptr_t PPCCommonProcessorInformation::getKernelStack() const
101 {
102  return kernel_stack;
103 }
104 void PPCCommonProcessorInformation::setKernelStack(uintptr_t stack)
105 {
106  kernel_stack = stack;
107 }
108 
109 #endif
VirtualAddressSpace & getVirtualAddressSpace() const
PPCCommonProcessorInformation(ProcessorId processorId)
PPCCommonProcessorInformation & operator=(const PPCCommonProcessorInformation &)
void setVirtualAddressSpace(VirtualAddressSpace &virtualAddressSpace)
The exception was caused by a hardware task switch.
Definition: Processor.h:80
size_t ProcessorId
Definition: Thread.h:54