diff options
| author | 2019-06-05 14:32:33 -0400 | |
|---|---|---|
| committer | 2019-07-03 20:31:40 -0400 | |
| commit | abdce723ebdcd0cb142b289af23d982dfcadaa12 (patch) | |
| tree | 77179c244bc6dd62476c1fc917885e30d58cfac0 /src/core/hle/kernel/process.h | |
| parent | kernel/vm_manager: Add overload of FindFreeRegion() that operates on a boundary (diff) | |
| download | yuzu-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/process.h')
| -rw-r--r-- | src/core/hle/kernel/process.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/hle/kernel/process.h b/src/core/hle/kernel/process.h index 248fd3840..39b098e9b 100644 --- a/src/core/hle/kernel/process.h +++ b/src/core/hle/kernel/process.h | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <bitset> | ||
| 9 | #include <cstddef> | 8 | #include <cstddef> |
| 10 | #include <list> | 9 | #include <list> |
| 11 | #include <string> | 10 | #include <string> |
| @@ -32,6 +31,7 @@ namespace Kernel { | |||
| 32 | class KernelCore; | 31 | class KernelCore; |
| 33 | class ResourceLimit; | 32 | class ResourceLimit; |
| 34 | class Thread; | 33 | class Thread; |
| 34 | class TLSPage; | ||
| 35 | 35 | ||
| 36 | struct CodeSet; | 36 | struct CodeSet; |
| 37 | 37 | ||
| @@ -260,10 +260,10 @@ public: | |||
| 260 | // Thread-local storage management | 260 | // Thread-local storage management |
| 261 | 261 | ||
| 262 | // Marks the next available region as used and returns the address of the slot. | 262 | // Marks the next available region as used and returns the address of the slot. |
| 263 | VAddr MarkNextAvailableTLSSlotAsUsed(Thread& thread); | 263 | [[nodiscard]] VAddr CreateTLSRegion(); |
| 264 | 264 | ||
| 265 | // Frees a used TLS slot identified by the given address | 265 | // Frees a used TLS slot identified by the given address |
| 266 | void FreeTLSSlot(VAddr tls_address); | 266 | void FreeTLSRegion(VAddr tls_address); |
| 267 | 267 | ||
| 268 | private: | 268 | private: |
| 269 | explicit Process(Core::System& system); | 269 | explicit Process(Core::System& system); |
| @@ -310,7 +310,7 @@ private: | |||
| 310 | /// holds the TLS for a specific thread. This vector contains which parts are in use for each | 310 | /// holds the TLS for a specific thread. This vector contains which parts are in use for each |
| 311 | /// page as a bitmask. | 311 | /// page as a bitmask. |
| 312 | /// This vector will grow as more pages are allocated for new threads. | 312 | /// This vector will grow as more pages are allocated for new threads. |
| 313 | std::vector<std::bitset<8>> tls_slots; | 313 | std::vector<TLSPage> tls_pages; |
| 314 | 314 | ||
| 315 | /// Contains the parsed process capability descriptors. | 315 | /// Contains the parsed process capability descriptors. |
| 316 | ProcessCapabilities capabilities; | 316 | ProcessCapabilities capabilities; |