Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1437)

Unified Diff: src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c

Issue 10392005: Thread suspension: Implement for Linux (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Comment about docs Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « SConstruct ('k') | src/trusted/service_runtime/build.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c
diff --git a/src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c b/src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c
index 5f3d516634dc749a2f0b56cb87dbe2d62db92fe9..4b27c0fc2a195c4b56c5594d127c0fb0d14ac6f6 100644
--- a/src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c
+++ b/src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c
@@ -58,6 +58,30 @@ uint32_t NaClGetThreadIdx(struct NaClAppThread *natp) {
return natp->user.gs >> 3;
}
+#if NACL_LINUX
+
+/*
+ * This TLS variable mirrors nacl_thread_index in the x86-64 sandbox,
+ * except that, on x86-32, we only use it for getting the identity of
+ * the interrupted thread in a signal handler in the Linux
+ * implementation of thread suspension.
+ *
+ * We should not enable this code on Windows because TLS variables do
+ * not work inside dynamically-loaded DLLs -- such as chrome.dll -- on
+ * Windows XP.
+ */
+THREAD uint32_t nacl_thread_index;
+
+void NaClTlsSetIdx(uint32_t tls_idx) {
+ nacl_thread_index = tls_idx;
+}
+
+uint32_t NaClTlsGetIdx(void) {
+ return nacl_thread_index;
+}
+
+#else
+
/*
* This is a NOOP, since TLS (or TSD) is not used to keep the thread
* index on the x86-32. We use segmentation (%gs) to provide access
@@ -67,3 +91,5 @@ uint32_t NaClGetThreadIdx(struct NaClAppThread *natp) {
void NaClTlsSetIdx(uint32_t tls_idx) {
UNREFERENCED_PARAMETER(tls_idx);
}
+
+#endif
« no previous file with comments | « SConstruct ('k') | src/trusted/service_runtime/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698