OLD | NEW |
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/nacl_platform.h" | 7 #include "native_client/src/include/nacl_platform.h" |
8 #include "native_client/src/include/nacl_macros.h" | 8 #include "native_client/src/include/nacl_macros.h" |
9 #include "native_client/src/include/portability.h" | 9 #include "native_client/src/include/portability.h" |
10 #include "native_client/src/shared/platform/nacl_check.h" | 10 #include "native_client/src/shared/platform/nacl_check.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 * Bias by 1: successful return value is never 0. | 101 * Bias by 1: successful return value is never 0. |
102 */ | 102 */ |
103 return idx + 1; | 103 return idx + 1; |
104 } | 104 } |
105 | 105 |
106 | 106 |
107 void NaClTlsFree(struct NaClAppThread *natp) { | 107 void NaClTlsFree(struct NaClAppThread *natp) { |
108 uint32_t idx = NaClGetThreadIdx(natp); | 108 uint32_t idx = NaClGetThreadIdx(natp); |
109 NaClLog(2, | 109 NaClLog(2, |
110 "NaClTlsFree: old idx %d $tp %x\n", | 110 "NaClTlsFree: old idx %d $tp %x\n", |
111 idx, natp->user.t8); | 111 idx, natp->user.tls_value1); |
112 | 112 |
113 NaClXMutexLock(&gNaClTlsMu); | 113 NaClXMutexLock(&gNaClTlsMu); |
114 gNaClThreadIdxInUse[idx - 1] = 0; | 114 gNaClThreadIdxInUse[idx - 1] = 0; |
115 NaClXMutexUnlock(&gNaClTlsMu); | 115 NaClXMutexUnlock(&gNaClTlsMu); |
116 | 116 |
117 natp->user.t8 = 0; | 117 natp->user.t8 = 0; |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 void NaClTlsSetTlsValue1(struct NaClAppThread *natp, uint32_t value) { | 121 void NaClTlsSetTlsValue1(struct NaClAppThread *natp, uint32_t value) { |
122 natp->user.t8 = value; | 122 natp->user.tls_value1 = value; |
123 } | 123 } |
124 | 124 |
125 | 125 |
126 void NaClTlsSetTlsValue2(struct NaClAppThread *natp, uint32_t value) { | 126 void NaClTlsSetTlsValue2(struct NaClAppThread *natp, uint32_t value) { |
127 natp->user.tls_value2 = value; | 127 natp->user.tls_value2 = value; |
128 } | 128 } |
129 | 129 |
130 | 130 |
131 uint32_t NaClTlsGetTlsValue1(struct NaClAppThread *natp) { | 131 uint32_t NaClTlsGetTlsValue1(struct NaClAppThread *natp) { |
132 return natp->user.t8; | 132 return natp->user.tls_value1; |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 uint32_t NaClTlsGetTlsValue2(struct NaClAppThread *natp) { | 136 uint32_t NaClTlsGetTlsValue2(struct NaClAppThread *natp) { |
137 return natp->user.tls_value2; | 137 return natp->user.tls_value2; |
138 } | 138 } |
OLD | NEW |