The Pedigree Project 0.1
arm64/ProcessorInformation.cc
1#include "pedigree/kernel/panic.h"
2#include "pedigree/kernel/process/InfoBlock.h"
3#include "pedigree/kernel/process/PerProcessorScheduler.h"
4#include "pedigree/kernel/process/Process.h"
5#include "pedigree/kernel/process/Thread.h"
6#include "pedigree/kernel/processor/VirtualAddressSpace.h"
7#include "pedigree/kernel/processor/arm64/ProcessorInformation.h"
8
9Arm64ProcessorInformation::Arm64ProcessorInformation(ProcessorId id)
10 : m_ProcessorId(id),
11 m_AddressSpace(&VirtualAddressSpace::getKernelAddressSpace()),
12 m_Thread(nullptr),
13 m_Scheduler(nullptr),
14 m_KernelStack(0),
15 m_DeviceHardIrqDepth(0) {}
16
17Arm64ProcessorInformation::~Arm64ProcessorInformation() = default;
18
19VirtualAddressSpace& Arm64ProcessorInformation::getVirtualAddressSpace() const {
20 return *m_AddressSpace;
21}
22
23void Arm64ProcessorInformation::setVirtualAddressSpace(VirtualAddressSpace& space) {
24 m_AddressSpace = &space;
25}
26
27void Arm64ProcessorInformation::setCurrentThread(Thread* thread) {
28 if (m_RcuState.active()) {
29 panic("Context switch inside an RCU read section.");
30 }
31 m_Thread = thread;
32 if (thread) {
33 InfoBlockManager::instance().setPid(thread->getParent()->getId());
34 }
35}
36
37PerProcessorScheduler& Arm64ProcessorInformation::getScheduler() {
38 if (!m_Scheduler) {
39 m_Scheduler = new PerProcessorScheduler();
40 }
41 return *m_Scheduler;
42}
size_t getId()
Definition Process.h:462
Process * getParent() const
Definition Thread.h:325
void EXPORTED_PUBLIC panic(const char *msg) NORETURN
Definition panic.cc:117
size_t ProcessorId