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

Unified Diff: src/trusted/service_runtime/arch/mips/nacl_tls.c

Issue 12218089: Remove nacl_user[] array lookup from syscall code path on x86-64 and MIPS (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 7 years, 10 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
Index: src/trusted/service_runtime/arch/mips/nacl_tls.c
diff --git a/src/trusted/service_runtime/arch/mips/nacl_tls.c b/src/trusted/service_runtime/arch/mips/nacl_tls.c
index b89b7772c34859764dba82aeeeafabe3fa9e9859..1e2e1a89d956e7c6045ec51816df00d22436e956 100644
--- a/src/trusted/service_runtime/arch/mips/nacl_tls.c
+++ b/src/trusted/service_runtime/arch/mips/nacl_tls.c
@@ -19,18 +19,15 @@
static struct NaClMutex gNaClTlsMu;
static int gNaClThreadIdxInUse[NACL_THREAD_MAX]; /* bool */
-/*
- * This holds the index of the current thread.
- * This is also used directly in nacl_syscall.S (NaClSyscallSeg).
- */
-__thread uint32_t gNaClThreadIdx = NACL_TLS_INDEX_INVALID;
+/* May be NULL if the current thread does not host a NaClAppThread. */
+THREAD struct NaClThreadContext *nacl_current_thread;
bsy 2013/02/19 19:03:08 maybe nacl_current_thread_context?
Mark Seaborn 2013/03/27 00:29:07 I opted to leave this as "nacl_current_thread" bec
-uint32_t NaClTlsGetIdx(void) {
- return gNaClThreadIdx;
+void NaClTlsSetCurrentThread(struct NaClAppThread *natp) {
+ nacl_current_thread = &natp->user;
}
-void NaClTlsSetIdx(uint32_t tls_idx) {
- gNaClThreadIdx = tls_idx;
+struct NaClAppThread *NaClTlsGetCurrentThread(void) {
+ return NaClAppThreadFromThreadContext(nacl_current_thread);
}
uint32_t NaClGetThreadIdx(struct NaClAppThread *natp) {
@@ -84,8 +81,9 @@ static int NaClThreadIdxAllocate(void) {
/*
- * Allocation does not mean we can set gNaClThreadIdx, since we are not
- * that thread. Setting it must wait until the thread actually launches.
+ * Allocation does not mean we can set nacl_current_thread, since we
+ * are not that thread. Setting it must wait until the thread
+ * actually launches.
*/
uint32_t NaClTlsAllocate(struct NaClAppThread *natp) {
int idx = NaClThreadIdxAllocate();
« no previous file with comments | « src/trusted/service_runtime/arch/mips/nacl_syscall.S ('k') | src/trusted/service_runtime/arch/x86_32/nacl_tls_32.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698