diff options
| -rw-r--r-- | src/core/core_cpu.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 14 | ||||
| -rw-r--r-- | src/core/hle/kernel/scheduler.h | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/core/core_cpu.cpp b/src/core/core_cpu.cpp index 21568ad50..0140e9713 100644 --- a/src/core/core_cpu.cpp +++ b/src/core/core_cpu.cpp | |||
| @@ -64,7 +64,7 @@ Cpu::Cpu(std::shared_ptr<ExclusiveMonitor> exclusive_monitor, | |||
| 64 | arm_interface = std::make_shared<ARM_Unicorn>(); | 64 | arm_interface = std::make_shared<ARM_Unicorn>(); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | scheduler = std::make_shared<Kernel::Scheduler>(arm_interface.get()); | 67 | scheduler = std::make_shared<Kernel::Scheduler>(*arm_interface); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | Cpu::~Cpu() = default; | 70 | Cpu::~Cpu() = default; |
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 69c812f16..9faf903cf 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp | |||
| @@ -17,7 +17,7 @@ namespace Kernel { | |||
| 17 | 17 | ||
| 18 | std::mutex Scheduler::scheduler_mutex; | 18 | std::mutex Scheduler::scheduler_mutex; |
| 19 | 19 | ||
| 20 | Scheduler::Scheduler(Core::ARM_Interface* cpu_core) : cpu_core(cpu_core) {} | 20 | Scheduler::Scheduler(Core::ARM_Interface& cpu_core) : cpu_core(cpu_core) {} |
| 21 | 21 | ||
| 22 | Scheduler::~Scheduler() { | 22 | Scheduler::~Scheduler() { |
| 23 | for (auto& thread : thread_list) { | 23 | for (auto& thread : thread_list) { |
| @@ -59,9 +59,9 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 59 | // Save context for previous thread | 59 | // Save context for previous thread |
| 60 | if (previous_thread) { | 60 | if (previous_thread) { |
| 61 | previous_thread->last_running_ticks = CoreTiming::GetTicks(); | 61 | previous_thread->last_running_ticks = CoreTiming::GetTicks(); |
| 62 | cpu_core->SaveContext(previous_thread->context); | 62 | cpu_core.SaveContext(previous_thread->context); |
| 63 | // Save the TPIDR_EL0 system register in case it was modified. | 63 | // Save the TPIDR_EL0 system register in case it was modified. |
| 64 | previous_thread->tpidr_el0 = cpu_core->GetTPIDR_EL0(); | 64 | previous_thread->tpidr_el0 = cpu_core.GetTPIDR_EL0(); |
| 65 | 65 | ||
| 66 | if (previous_thread->status == ThreadStatus::Running) { | 66 | if (previous_thread->status == ThreadStatus::Running) { |
| 67 | // This is only the case when a reschedule is triggered without the current thread | 67 | // This is only the case when a reschedule is triggered without the current thread |
| @@ -91,10 +91,10 @@ void Scheduler::SwitchContext(Thread* new_thread) { | |||
| 91 | SetCurrentPageTable(&Core::CurrentProcess()->vm_manager.page_table); | 91 | SetCurrentPageTable(&Core::CurrentProcess()->vm_manager.page_table); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | cpu_core->LoadContext(new_thread->context); | 94 | cpu_core.LoadContext(new_thread->context); |
| 95 | cpu_core->SetTlsAddress(new_thread->GetTLSAddress()); | 95 | cpu_core.SetTlsAddress(new_thread->GetTLSAddress()); |
| 96 | cpu_core->SetTPIDR_EL0(new_thread->GetTPIDR_EL0()); | 96 | cpu_core.SetTPIDR_EL0(new_thread->GetTPIDR_EL0()); |
| 97 | cpu_core->ClearExclusiveState(); | 97 | cpu_core.ClearExclusiveState(); |
| 98 | } else { | 98 | } else { |
| 99 | current_thread = nullptr; | 99 | current_thread = nullptr; |
| 100 | // Note: We do not reset the current process and current page table when idling because | 100 | // Note: We do not reset the current process and current page table when idling because |
diff --git a/src/core/hle/kernel/scheduler.h b/src/core/hle/kernel/scheduler.h index 744990c9b..2c94641ec 100644 --- a/src/core/hle/kernel/scheduler.h +++ b/src/core/hle/kernel/scheduler.h | |||
| @@ -19,7 +19,7 @@ namespace Kernel { | |||
| 19 | 19 | ||
| 20 | class Scheduler final { | 20 | class Scheduler final { |
| 21 | public: | 21 | public: |
| 22 | explicit Scheduler(Core::ARM_Interface* cpu_core); | 22 | explicit Scheduler(Core::ARM_Interface& cpu_core); |
| 23 | ~Scheduler(); | 23 | ~Scheduler(); |
| 24 | 24 | ||
| 25 | /// Returns whether there are any threads that are ready to run. | 25 | /// Returns whether there are any threads that are ready to run. |
| @@ -72,7 +72,7 @@ private: | |||
| 72 | 72 | ||
| 73 | SharedPtr<Thread> current_thread = nullptr; | 73 | SharedPtr<Thread> current_thread = nullptr; |
| 74 | 74 | ||
| 75 | Core::ARM_Interface* cpu_core; | 75 | Core::ARM_Interface& cpu_core; |
| 76 | 76 | ||
| 77 | static std::mutex scheduler_mutex; | 77 | static std::mutex scheduler_mutex; |
| 78 | }; | 78 | }; |