1 /* Copyright (C) 2008 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
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
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 /* Get the arch-specific version. */
21 #include_next <pthreaddef.h>
23 /* Register atfork handlers to protect signal_lock. */
24 extern void sigaction_atfork (void);
26 /* We need to tell the kernel about the allocated stack. */
27 #define PLATFORM_THREAD_START \
29 pd->stack.ss_sp = pd->stackblock; \
30 pd->stack.ss_sp = pd->stackblock_size; \
31 pd->stack.ss_flags = 0; \
32 setustack (&pd->stack); \
35 #ifndef __stack_t_defined
36 # define __need_stack_t
37 # include <bits/sigstack.h>
40 #define PLATFORM_PTHREAD_INIT \
41 sigaction_atfork (); \
42 THREAD_SETMEM (pd, main_thread, 1); \
44 if (getustack (&_stack) == 0 && _stack) \
46 pd->stackblock = _stack->ss_sp; \
47 pd->stackblock_size = _stack->ss_size; \
50 /* Additional descr fields. */
51 # define PLATFORM_DESCR_FIELDS \
55 /* stackblock/stackblock_size should always be filled. */
56 #define GET_MAIN_STACK_INFO(stackaddr, stacksize) ENOSYS
58 /* Use tid as pthread_t (instead of descr). */
59 #define PTHREAD_T_IS_TID
61 /* Use pthread scheduler functions in tpp. */
62 #define TPP_PTHREAD_SCHED
64 /* pthread_ is unsigned. */
65 #define FREE_P(descr) ((descr)->tid == (pthread_t)-1)
67 /* The first thread has a large (10M) stack so use the arch defaults. */
68 #define PTHREAD_USE_ARCH_STACK_DEFAULT_SIZE
70 /* It is known that the first lwpid is 1. */
71 #define FIRST_THREAD_TID 1
73 /* We need to be passed the stacksize. */
74 #define NEED_STACK_SIZE
76 /* __exit_thread_inline is the same for all architectures. */
77 #include <inline-syscall.h>
79 DECLARE_INLINE_SYSCALL (void, lwp_exit, void);
81 #undef __exit_thread_inline
82 #define __exit_thread_inline(val) \
83 INLINE_SYSCALL (lwp_exit, 0);