| 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
|
|
|