summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.h
diff options
context:
space:
mode:
authorGravatar Lioncash2019-06-05 14:32:33 -0400
committerGravatar Lioncash2019-07-03 20:31:40 -0400
commitabdce723ebdcd0cb142b289af23d982dfcadaa12 (patch)
tree77179c244bc6dd62476c1fc917885e30d58cfac0 /src/core/hle/kernel/thread.h
parentkernel/vm_manager: Add overload of FindFreeRegion() that operates on a boundary (diff)
downloadyuzu-abdce723ebdcd0cb142b289af23d982dfcadaa12.tar.gz
yuzu-abdce723ebdcd0cb142b289af23d982dfcadaa12.tar.xz
yuzu-abdce723ebdcd0cb142b289af23d982dfcadaa12.zip
kernel/process: Decouple TLS handling from threads
Extracts out all of the thread local storage management from thread instances themselves and makes the owning process handle the management of the memory. This brings the memory management slightly more in line with how the kernel handles these allocations. Furthermore, this also makes the TLS page management a little more readable compared to the lingering implementation that was carried over from Citra.
Diffstat (limited to 'src/core/hle/kernel/thread.h')
-rw-r--r--src/core/hle/kernel/thread.h16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index b4b9cda7c..07e989637 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -5,7 +5,6 @@
5#pragma once 5#pragma once
6 6
7#include <functional> 7#include <functional>
8#include <memory>
9#include <string> 8#include <string>
10#include <vector> 9#include <vector>
11 10
@@ -78,9 +77,6 @@ enum class ThreadActivity : u32 {
78 77
79class Thread final : public WaitObject { 78class Thread final : public WaitObject {
80public: 79public:
81 using TLSMemory = std::vector<u8>;
82 using TLSMemoryPtr = std::shared_ptr<TLSMemory>;
83
84 using MutexWaitingThreads = std::vector<SharedPtr<Thread>>; 80 using MutexWaitingThreads = std::vector<SharedPtr<Thread>>;
85 81
86 using ThreadContext = Core::ARM_Interface::ThreadContext; 82 using ThreadContext = Core::ARM_Interface::ThreadContext;
@@ -169,14 +165,6 @@ public:
169 return thread_id; 165 return thread_id;
170 } 166 }
171 167
172 TLSMemoryPtr& GetTLSMemory() {
173 return tls_memory;
174 }
175
176 const TLSMemoryPtr& GetTLSMemory() const {
177 return tls_memory;
178 }
179
180 /// Resumes a thread from waiting 168 /// Resumes a thread from waiting
181 void ResumeFromWait(); 169 void ResumeFromWait();
182 170
@@ -463,11 +451,9 @@ private:
463 u32 ideal_core{0xFFFFFFFF}; 451 u32 ideal_core{0xFFFFFFFF};
464 u64 affinity_mask{0x1}; 452 u64 affinity_mask{0x1};
465 453
466 TLSMemoryPtr tls_memory = std::make_shared<TLSMemory>(); 454 ThreadActivity activity = ThreadActivity::Normal;
467 455
468 std::string name; 456 std::string name;
469
470 ThreadActivity activity = ThreadActivity::Normal;
471}; 457};
472 458
473/** 459/**