From 115ad8e16a69c8823118f210654fc9ea70a03213 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 10 May 2015 18:43:59 -0500 Subject: fixup! Set the TLS address in the scheduler --- src/core/hle/kernel/thread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/core/hle/kernel/thread.cpp') diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 61199c12..5de8f9a7 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) { new_thread->current_priority = new_thread->nominal_priority; Core::g_app_core->LoadContext(new_thread->context); + Core::g_app_core->SetCP15Register(CP15_THREAD_URO, new_thread->GetTLSAddress()); } else { current_thread = nullptr; } @@ -406,9 +407,11 @@ ResultVal> Thread::Create(std::string name, VAddr entry_point, ASSERT_MSG(tls_address < Memory::TLS_AREA_VADDR_END, "Too many threads"); + thread->tls_address = tls_address; + // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used // to initialize the context - Core::g_app_core->ResetContext(thread->context, stack_top, entry_point, arg, tls_address); + Core::g_app_core->ResetContext(thread->context, stack_top, entry_point, arg); ready_queue.push_back(thread->current_priority, thread.get()); thread->status = THREADSTATUS_READY; @@ -500,7 +503,7 @@ void Thread::SetWaitSynchronizationOutput(s32 output) { } VAddr Thread::GetTLSAddress() const { - return context.tls; + return tls_address; } //////////////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3