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

Side by Side Diff: src/trusted/service_runtime/linux/thread_suspension.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 unified diff | Download patch | Annotate | Revision Log
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 #include "native_client/src/trusted/service_runtime/linux/android_compat.h" 6 #include "native_client/src/trusted/service_runtime/linux/android_compat.h"
7 7
8 #include <errno.h> 8 #include <errno.h>
9 #include <linux/futex.h> 9 #include <linux/futex.h>
10 #include <signal.h> 10 #include <signal.h>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 /* We have been asked to suspend, so wait. */ 73 /* We have been asked to suspend, so wait. */
74 FutexWait(&natp->suspend_state, state); 74 FutexWait(&natp->suspend_state, state);
75 } else { 75 } else {
76 NaClLog(LOG_FATAL, "NaClAppThreadSetSuspendState: Unexpected state: %i\n", 76 NaClLog(LOG_FATAL, "NaClAppThreadSetSuspendState: Unexpected state: %i\n",
77 state); 77 state);
78 } 78 }
79 } 79 }
80 } 80 }
81 81
82 static void HandleSuspendSignal(struct NaClSignalContext *regs) { 82 static void HandleSuspendSignal(struct NaClSignalContext *regs) {
83 uint32_t tls_idx = NaClTlsGetIdx(); 83 struct NaClAppThread *natp = NaClTlsGetCurrentThread();
84 struct NaClAppThread *natp = NaClAppThreadGetFromIndex(tls_idx);
85 struct NaClSignalContext *suspended_registers = 84 struct NaClSignalContext *suspended_registers =
86 &natp->suspended_registers->context; 85 &natp->suspended_registers->context;
87 86
88 /* Sanity check. */ 87 /* Sanity check. */
89 if (natp->suspend_state != (NACL_APP_THREAD_UNTRUSTED | 88 if (natp->suspend_state != (NACL_APP_THREAD_UNTRUSTED |
90 NACL_APP_THREAD_SUSPENDING)) { 89 NACL_APP_THREAD_SUSPENDING)) {
91 NaClSignalErrorMessage("HandleSuspendSignal: " 90 NaClSignalErrorMessage("HandleSuspendSignal: "
92 "Unexpected suspend_state\n"); 91 "Unexpected suspend_state\n");
93 NaClAbort(); 92 NaClAbort();
94 } 93 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 NACL_APP_THREAD_SUSPENDING)); 307 NACL_APP_THREAD_SUSPENDING));
309 308
310 if (natp->fault_signal == 0) { 309 if (natp->fault_signal == 0) {
311 return 0; 310 return 0;
312 } 311 }
313 *signal = natp->fault_signal; 312 *signal = natp->fault_signal;
314 natp->fault_signal = 0; 313 natp->fault_signal = 0;
315 AtomicIncrement(&natp->nap->faulted_thread_count, -1); 314 AtomicIncrement(&natp->nap->faulted_thread_count, -1);
316 return 1; 315 return 1;
317 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698