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.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 61199c12a..5de8f9a73 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -197,6 +197,7 @@ static void SwitchContext(Thread* new_thread) {
197 new_thread->current_priority = new_thread->nominal_priority; 197 new_thread->current_priority = new_thread->nominal_priority;
198 198
199 Core::g_app_core->LoadContext(new_thread->context); 199 Core::g_app_core->LoadContext(new_thread->context);
200 Core::g_app_core->SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress());
200 } else { 201 } else {
201 current_thread = nullptr; 202 current_thread = nullptr;
202 } 203 }
@@ -406,9 +407,11 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point,
406 407
407 ASSERT_MSG(tls_address < Memory::TLS_AREA_VADDR_END, "Too many threads"); 408 ASSERT_MSG(tls_address < Memory::TLS_AREA_VADDR_END, "Too many threads");
408 409
410 thread->tls_address = tls_address;
411
409 // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used 412 // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used
410 // to initialize the context 413 // to initialize the context
411 Core::g_app_core->ResetContext(thread->context, stack_top, entry_point, arg, tls_address); 414 Core::g_app_core->ResetContext(thread->context, stack_top, entry_point, arg);
412 415
413 ready_queue.push_back(thread->current_priority, thread.get()); 416 ready_queue.push_back(thread->current_priority, thread.get());
414 thread->status = THREADSTATUS_READY; 417 thread->status = THREADSTATUS_READY;
@@ -500,7 +503,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) {
500} 503}
501 504
502VAddr Thread::GetTLSAddress() const { 505VAddr Thread::GetTLSAddress() const {
503 return context.tls; 506 return tls_address;
504} 507}
505 508
506//////////////////////////////////////////////////////////////////////////////////////////////////// 509////////////////////////////////////////////////////////////////////////////////////////////////////