Kernel/Threads: Dynamically allocate the TLS region for threads in the BASE region of the linear heap.

Each thread gets a 0x200-byte area from the 0x1000-sized page, when all 8 thread slots in a single page are used up, the kernel allocates a new page to hold another 8 entries.

This is consistent with what the real kernel does.
This commit is contained in:
Subv 2016-04-19 17:12:48 -05:00
parent 3e7e8daf59
commit d192fb066d
5 changed files with 74 additions and 28 deletions

View file

@ -127,7 +127,7 @@ public:
* Returns the Thread Local Storage address of the current thread
* @returns VAddr of the thread's TLS
*/
VAddr GetTLSAddress() const;
VAddr GetTLSAddress() const { return tls_address; }
Core::ThreadContext context;
@ -144,7 +144,7 @@ public:
s32 processor_id;
s32 tls_index; ///< Index of the Thread Local Storage of the thread
VAddr tls_address; ///< Virtual address of the Thread Local Storage of the thread
bool waitsynch_waited; ///< Set to true if the last svcWaitSynch call caused the thread to wait