summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 18b696f72..5fb95dada 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -14,7 +14,6 @@
14#include "core/arm/skyeye_common/armstate.h" 14#include "core/arm/skyeye_common/armstate.h"
15#include "core/core.h" 15#include "core/core.h"
16#include "core/core_timing.h" 16#include "core/core_timing.h"
17#include "core/hle/hle.h"
18#include "core/hle/kernel/kernel.h" 17#include "core/hle/kernel/kernel.h"
19#include "core/hle/kernel/memory.h" 18#include "core/hle/kernel/memory.h"
20#include "core/hle/kernel/mutex.h" 19#include "core/hle/kernel/mutex.h"
@@ -188,7 +187,7 @@ static void SwitchContext(Thread* new_thread) {
188 // Save context for previous thread 187 // Save context for previous thread
189 if (previous_thread) { 188 if (previous_thread) {
190 previous_thread->last_running_ticks = CoreTiming::GetTicks(); 189 previous_thread->last_running_ticks = CoreTiming::GetTicks();
191 Core::g_app_core->SaveContext(previous_thread->context); 190 Core::CPU().SaveContext(previous_thread->context);
192 191
193 if (previous_thread->status == THREADSTATUS_RUNNING) { 192 if (previous_thread->status == THREADSTATUS_RUNNING) {
194 // This is only the case when a reschedule is triggered without the current thread 193 // This is only the case when a reschedule is triggered without the current thread
@@ -214,8 +213,8 @@ static void SwitchContext(Thread* new_thread) {
214 // Restores thread to its nominal priority if it has been temporarily changed 213 // Restores thread to its nominal priority if it has been temporarily changed
215 new_thread->current_priority = new_thread->nominal_priority; 214 new_thread->current_priority = new_thread->nominal_priority;
216 215
217 Core::g_app_core->LoadContext(new_thread->context); 216 Core::CPU().LoadContext(new_thread->context);
218 Core::g_app_core->SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); 217 Core::CPU().SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
219 } else { 218 } else {
220 current_thread = nullptr; 219 current_thread = nullptr;
221 } 220 }
@@ -330,7 +329,7 @@ void Thread::ResumeFromWait() {
330 329
331 ready_queue.push_back(current_priority, this); 330 ready_queue.push_back(current_priority, this);
332 status = THREADSTATUS_READY; 331 status = THREADSTATUS_READY;
333 HLE::Reschedule(__func__); 332 Core::System::GetInstance().PrepareReschedule();
334} 333}
335 334
336/** 335/**
@@ -385,9 +384,9 @@ std::tuple<u32, u32, bool> GetFreeThreadLocalSlot(std::vector<std::bitset<8>>& t
385 * @param entry_point Address of entry point for execution 384 * @param entry_point Address of entry point for execution
386 * @param arg User argument for thread 385 * @param arg User argument for thread
387 */ 386 */
388static void ResetThreadContext(Core::ThreadContext& context, u32 stack_top, u32 entry_point, 387static void ResetThreadContext(ARM_Interface::ThreadContext& context, u32 stack_top,
389 u32 arg) { 388 u32 entry_point, u32 arg) {
390 memset(&context, 0, sizeof(Core::ThreadContext)); 389 memset(&context, 0, sizeof(ARM_Interface::ThreadContext));
391 390
392 context.cpu_registers[0] = arg; 391 context.cpu_registers[0] = arg;
393 context.pc = entry_point; 392 context.pc = entry_point;
@@ -545,8 +544,6 @@ void Reschedule() {
545 Thread* cur = GetCurrentThread(); 544 Thread* cur = GetCurrentThread();
546 Thread* next = PopNextReadyThread(); 545 Thread* next = PopNextReadyThread();
547 546
548 HLE::DoneRescheduling();
549
550 if (cur && next) { 547 if (cur && next) {
551 LOG_TRACE(Kernel, "context switch %u -> %u", cur->GetObjectId(), next->GetObjectId()); 548 LOG_TRACE(Kernel, "context switch %u -> %u", cur->GetObjectId(), next->GetObjectId());
552 } else if (cur) { 549 } else if (cur) {