OLD | NEW |
1 /* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc. | 1 /* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc. |
2 This file is part of the GNU C Library. | 2 This file is part of the GNU C Library. |
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. | 3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. |
4 | 4 |
5 The GNU C Library is free software; you can redistribute it and/or | 5 The GNU C Library is free software; you can redistribute it and/or |
6 modify it under the terms of the GNU Lesser General Public | 6 modify it under the terms of the GNU Lesser General Public |
7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
8 version 2.1 of the License, or (at your option) any later version. | 8 version 2.1 of the License, or (at your option) any later version. |
9 | 9 |
10 The GNU C Library is distributed in the hope that it will be useful, | 10 The GNU C Library is distributed in the hope that it will be useful, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 we momentarily store a false value; this doesn't matter because there | 71 we momentarily store a false value; this doesn't matter because there |
72 is no kosher thing a signal handler interrupting us right here can do | 72 is no kosher thing a signal handler interrupting us right here can do |
73 that cares whether the thread count is correct. */ | 73 that cares whether the thread count is correct. */ |
74 atomic_increment (&__nptl_nthreads); | 74 atomic_increment (&__nptl_nthreads); |
75 | 75 |
76 #ifndef __native_client__ | 76 #ifndef __native_client__ |
77 #error "This code was changed to work only in Native Client" | 77 #error "This code was changed to work only in Native Client" |
78 #endif | 78 #endif |
79 | 79 |
80 /* Native Client does not have a notion of a thread ID, so we make | 80 /* Native Client does not have a notion of a thread ID, so we make |
81 one up. This must be positive to mark the thread as not | 81 one up. This must be small enough to leave space for number identifying |
82 exited. */ | 82 the clock. Use CLOCK_IDFIELD_SIZE to guarantee that. */ |
83 pd->tid = ((unsigned int) pd) >> 2; | 83 pd->tid = ((unsigned int) pd) >> CLOCK_IDFIELD_SIZE; |
84 | 84 |
85 /* Native Client syscall thread_create does not push return address onto stack | 85 /* Native Client syscall thread_create does not push return address onto stack |
86 as opposed to the kernel. We emulate this behavior on x86-64 to meet the | 86 as opposed to the kernel. We emulate this behavior on x86-64 to meet the |
87 ABI requirement ((%rsp + 8) mod 16 == 0). On x86-32 the attribute | 87 ABI requirement ((%rsp + 8) mod 16 == 0). On x86-32 the attribute |
88 'force_align_arg_pointer' does the same for start_thread (). */ | 88 'force_align_arg_pointer' does the same for start_thread (). */ |
89 #ifdef __x86_64__ | 89 #ifdef __x86_64__ |
90 STACK_VARIABLES_ARGS -= 8; | 90 STACK_VARIABLES_ARGS -= 8; |
91 #endif | 91 #endif |
92 | 92 |
93 if (__nacl_irt_thread_create (fct, STACK_VARIABLES_ARGS, pd) != 0) | 93 if (__nacl_irt_thread_create (fct, STACK_VARIABLES_ARGS, pd) != 0) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 /* Actually create the thread. */ | 266 /* Actually create the thread. */ |
267 int res = do_clone (pd, attr, clone_flags, start_thread, | 267 int res = do_clone (pd, attr, clone_flags, start_thread, |
268 STACK_VARIABLES_ARGS, stopped); | 268 STACK_VARIABLES_ARGS, stopped); |
269 | 269 |
270 if (res == 0 && stopped) | 270 if (res == 0 && stopped) |
271 /* And finally restart the new thread. */ | 271 /* And finally restart the new thread. */ |
272 lll_unlock (pd->lock, LLL_PRIVATE); | 272 lll_unlock (pd->lock, LLL_PRIVATE); |
273 | 273 |
274 return res; | 274 return res; |
275 } | 275 } |
OLD | NEW |