summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-05-11 01:43:59 +0200
committerSubv <subv2112@gmail.com>2015-05-11 01:43:59 +0200
commit115ad8e16a69c8823118f210654fc9ea70a03213 (patch)
tree945fc0617a3329e14f0b4ec3cf2679a0054cbb7b /src/core/hle
parentCore/Memory: Give every emulated thread it's own TLS area. (diff)
downloadyuzu-115ad8e16a69c8823118f210654fc9ea70a03213.tar
yuzu-115ad8e16a69c8823118f210654fc9ea70a03213.tar.gz
yuzu-115ad8e16a69c8823118f210654fc9ea70a03213.tar.bz2
yuzu-115ad8e16a69c8823118f210654fc9ea70a03213.tar.lz
yuzu-115ad8e16a69c8823118f210654fc9ea70a03213.tar.xz
yuzu-115ad8e16a69c8823118f210654fc9ea70a03213.tar.zst
yuzu-115ad8e16a69c8823118f210654fc9ea70a03213.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/thread.cpp7
-rw-r--r--src/core/hle/kernel/thread.h2
2 files changed, 7 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) {
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<SharedPtr<Thread>> 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;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 17bb69f45..6891c8c2f 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -156,6 +156,8 @@ public:
s32 processor_id;
+ VAddr tls_address; ///< Address of the Thread Local Storage of the thread
+
/// Mutexes currently held by this thread, which will be released when it exits.
boost::container::flat_set<SharedPtr<Mutex>> held_mutexes;