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

Side by Side Diff: src/untrusted/irt/irt_private_tls.c

Issue 140653005: Adds tls_edit utility which patches irt_core.nexe's TLS usage. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: gyp builds with host toolsets should not inherit target flags for arm and mips Created 6 years, 11 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 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <unistd.h> 9 #include <unistd.h>
10 10
(...skipping 19 matching lines...) Expand all
30 return -NACL_SYSCALL(second_tls_set)(thread_ptr); 30 return -NACL_SYSCALL(second_tls_set)(thread_ptr);
31 } 31 }
32 32
33 void *nacl_tls_get(void) { 33 void *nacl_tls_get(void) {
34 #if defined(__i386__) 34 #if defined(__i386__)
35 /* 35 /*
36 * Calling second_tls_get() works on x86-32, but reading %gs:4 is a 36 * Calling second_tls_get() works on x86-32, but reading %gs:4 is a
37 * lot faster. 37 * lot faster.
38 */ 38 */
39 void *result; 39 void *result;
40 __asm__("mov %%gs:4, %0" : "=r"(result)); 40 __asm__("mov %%gs:0, %0" : "=r"(result));
41 return result; 41 return result;
42 #else 42 #else
43 return NACL_SYSCALL(second_tls_get)(); 43 return NACL_SYSCALL(second_tls_get)();
44 #endif 44 #endif
45 } 45 }
46 46
47 void *__nacl_read_tp(void) { 47 void *__nacl_read_tp(void) {
48 return nacl_tls_get(); 48 return nacl_tls_get();
49 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698