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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « SConstruct ('k') | src/trusted/service_runtime/build.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/include/portability.h" 7 #include "native_client/src/include/portability.h"
8 8
9 #include "native_client/src/shared/platform/nacl_check.h" 9 #include "native_client/src/shared/platform/nacl_check.h"
10 #include "native_client/src/trusted/service_runtime/arch/x86/nacl_ldt_x86.h" 10 #include "native_client/src/trusted/service_runtime/arch/x86/nacl_ldt_x86.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 0, 51 0,
52 base_addr, 52 base_addr,
53 4); 53 4);
54 } 54 }
55 55
56 56
57 uint32_t NaClGetThreadIdx(struct NaClAppThread *natp) { 57 uint32_t NaClGetThreadIdx(struct NaClAppThread *natp) {
58 return natp->user.gs >> 3; 58 return natp->user.gs >> 3;
59 } 59 }
60 60
61 #if NACL_LINUX
62
63 /*
64 * This TLS variable mirrors nacl_thread_index in the x86-64 sandbox,
65 * except that, on x86-32, we only use it for getting the identity of
66 * the interrupted thread in a signal handler in the Linux
67 * implementation of thread suspension.
68 *
69 * We should not enable this code on Windows because TLS variables do
70 * not work inside dynamically-loaded DLLs -- such as chrome.dll -- on
71 * Windows XP.
72 */
73 THREAD uint32_t nacl_thread_index;
74
75 void NaClTlsSetIdx(uint32_t tls_idx) {
76 nacl_thread_index = tls_idx;
77 }
78
79 uint32_t NaClTlsGetIdx(void) {
80 return nacl_thread_index;
81 }
82
83 #else
84
61 /* 85 /*
62 * This is a NOOP, since TLS (or TSD) is not used to keep the thread 86 * This is a NOOP, since TLS (or TSD) is not used to keep the thread
63 * index on the x86-32. We use segmentation (%gs) to provide access 87 * index on the x86-32. We use segmentation (%gs) to provide access
64 * to the per-thread data, and the segment selector itself tells us 88 * to the per-thread data, and the segment selector itself tells us
65 * the thread's identity. 89 * the thread's identity.
66 */ 90 */
67 void NaClTlsSetIdx(uint32_t tls_idx) { 91 void NaClTlsSetIdx(uint32_t tls_idx) {
68 UNREFERENCED_PARAMETER(tls_idx); 92 UNREFERENCED_PARAMETER(tls_idx);
69 } 93 }
94
95 #endif
OLDNEW
« 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