From 000876858d52d7e4fa8e21bc4407d43d548eff30 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 10 May 2015 18:35:37 -0500 Subject: Core/Memory: Give every emulated thread it's own TLS area. The TLS area for thread T with id Ti is located at TLS_AREA_VADDR + (Ti - 1) * 0x200. This allows some games like Mario Kart 7 to continue further. --- src/core/hle/kernel/thread.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/core/hle/kernel/thread.h') diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 9958b16e6..17bb69f45 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -135,6 +135,12 @@ public: */ void Stop(); + /* + * Returns the Thread Local Storage address of the current thread + * @returns VAddr of the thread's TLS + */ + VAddr GetTLSAddress() const; + Core::ThreadContext context; u32 thread_id; -- cgit v1.2.3 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.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/hle/kernel/thread.h') 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> held_mutexes; -- cgit v1.2.3