OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2013 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 <assert.h> | 7 #include <assert.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 return g_tls_value; | 355 return g_tls_value; |
356 } | 356 } |
357 | 357 |
358 /* For newlib based nonsfi_loader, we use the one defined in pnacl_irt.c. */ | 358 /* For newlib based nonsfi_loader, we use the one defined in pnacl_irt.c. */ |
359 #if !defined(__native_client__) | 359 #if !defined(__native_client__) |
360 void *__nacl_read_tp(void) { | 360 void *__nacl_read_tp(void) { |
361 return g_tls_value; | 361 return g_tls_value; |
362 } | 362 } |
363 #endif | 363 #endif |
364 | 364 |
| 365 #if defined(__arm_nonsfi_linux__) |
| 366 |
| 367 __asm__(".pushsection .text, \"ax\", %progbits\n" |
| 368 ".global __aeabi_read_tp\n" |
| 369 ".type __aeabi_read_tp, %function\n" |
| 370 ".arm\n" |
| 371 "__aeabi_read_tp:\n" |
| 372 "push {r1-r3, lr}\n" |
| 373 "vpush {d0-d7}\n" |
| 374 "blx aeabi_read_tp_impl\n" |
| 375 "vpop {d0-d7}\n" |
| 376 "pop {r1-r3, pc}\n" |
| 377 ".popsection\n"); |
| 378 |
| 379 void *aeabi_read_tp_impl(void) { |
| 380 return g_tls_value; |
| 381 } |
| 382 |
| 383 #endif |
| 384 |
| 385 |
365 struct thread_args { | 386 struct thread_args { |
366 void (*start_func)(void); | 387 void (*start_func)(void); |
367 void *thread_ptr; | 388 void *thread_ptr; |
368 }; | 389 }; |
369 | 390 |
370 static void *start_thread(void *arg) { | 391 static void *start_thread(void *arg) { |
371 struct thread_args args = *(struct thread_args *) arg; | 392 struct thread_args args = *(struct thread_args *) arg; |
372 free(arg); | 393 free(arg); |
373 g_tls_value = args.thread_ptr; | 394 g_tls_value = args.thread_ptr; |
374 args.start_func(); | 395 args.start_func(); |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 | 884 |
864 #if defined(DEFINE_MAIN) | 885 #if defined(DEFINE_MAIN) |
865 int main(int argc, char **argv, char **environ) { | 886 int main(int argc, char **argv, char **environ) { |
866 nacl_irt_nonsfi_allow_dev_interfaces(); | 887 nacl_irt_nonsfi_allow_dev_interfaces(); |
867 nacl_entry_func_t entry_func = USER_START; | 888 nacl_entry_func_t entry_func = USER_START; |
868 | 889 |
869 return nacl_irt_nonsfi_entry(argc, argv, environ, entry_func, | 890 return nacl_irt_nonsfi_entry(argc, argv, environ, entry_func, |
870 nacl_irt_query_core); | 891 nacl_irt_query_core); |
871 } | 892 } |
872 #endif | 893 #endif |
OLD | NEW |