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

Unified Diff: src/trusted/service_runtime/arch/arm/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/arm/nacl_tls.c
diff --git a/src/trusted/service_runtime/arch/arm/nacl_tls.c b/src/trusted/service_runtime/arch/arm/nacl_tls.c
index 9d3f7df13285e87dd54baf1fb8f4055a7b4db46f..5324ee94dceb7e7c1de85207813f969ed58f7f95 100644
--- a/src/trusted/service_runtime/arch/arm/nacl_tls.c
+++ b/src/trusted/service_runtime/arch/arm/nacl_tls.c
@@ -20,18 +20,15 @@ static struct NaClMutex gNaClTlsMu;
static int gNaClThreadIdxInUse[NACL_THREAD_MAX]; /* bool */
static size_t const kNumThreads = NACL_ARRAY_SIZE_UNSAFE(gNaClThreadIdxInUse);
-/*
- * 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. */
+static THREAD struct NaClThreadContext *nacl_current_thread;
-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) {
UNREFERENCED_PARAMETER(natp);
« no previous file with comments | « no previous file | src/trusted/service_runtime/arch/mips/nacl_syscall.S » ('j') | src/trusted/service_runtime/arch/mips/nacl_tls.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698