OSDN Git Service

sparc: remove sparc64/sparcv9 code
[uclinux-h8/uClibc.git] / libpthread / nptl / sysdeps / unix / sysv / linux / sparc / sysdep-cancel.h
1 /* Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
4
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.
9
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.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <http://www.gnu.org/licenses/>.  */
18
19 #include <tls.h>
20 #include <sysdep.h>
21 #ifndef __ASSEMBLER__
22 # include <pthreadP.h>
23 #endif
24
25 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
26
27 # undef PSEUDO
28 # define PSEUDO(name, syscall_name, args)       \
29         .text;                                  \
30         .globl          __syscall_error;        \
31 ENTRY(name)                                     \
32         ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1;\
33         cmp %g1, 0;                             \
34         bne 1f;                                 \
35 .type   __##syscall_name##_nocancel,@function;  \
36 .globl  __##syscall_name##_nocancel;            \
37 __##syscall_name##_nocancel:                    \
38          mov SYS_ify(syscall_name), %g1;        \
39         ta 0x10;                                \
40         bcc 8f;                                 \
41          mov %o7, %g1;                          \
42         call __syscall_error;                   \
43          mov %g1, %o7;                          \
44 8:      jmpl %o7 + 8, %g0;                      \
45          nop;                                   \
46 .size   __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;\
47 1:      save %sp, -96, %sp;                     \
48         cfi_def_cfa_register(%fp);              \
49         cfi_window_save;                        \
50         cfi_register(%o7, %i7);                 \
51         CENABLE;                                \
52          nop;                                   \
53         mov %o0, %l0;                           \
54         COPY_ARGS_##args                        \
55         mov SYS_ify(syscall_name), %g1;         \
56         ta 0x10;                                \
57         bcc 1f;                                 \
58          mov %o0, %l1;                          \
59         CDISABLE;                               \
60          mov %l0, %o0;                          \
61         call __syscall_error;                   \
62          mov %l1, %o0;                          \
63         b 2f;                                   \
64          mov -1, %l1;                           \
65 1:      CDISABLE;                               \
66          mov %l0, %o0;                          \
67 2:      jmpl %i7 + 8, %g0;                      \
68          restore %g0, %l1, %o0;
69
70
71 # ifdef IS_IN_libpthread
72 #  define CENABLE       call __pthread_enable_asynccancel
73 #  define CDISABLE      call __pthread_disable_asynccancel
74 # elif !defined NOT_IN_libc
75 #  define CENABLE       call __libc_enable_asynccancel
76 #  define CDISABLE      call __libc_disable_asynccancel
77 # elif defined IS_IN_librt
78 #  define CENABLE       call __librt_enable_asynccancel
79 #  define CDISABLE      call __librt_disable_asynccancel
80 # else
81 #  error Unsupported library
82 # endif
83
84 #define COPY_ARGS_0     /* Nothing */
85 #define COPY_ARGS_1     COPY_ARGS_0 mov %i0, %o0;
86 #define COPY_ARGS_2     COPY_ARGS_1 mov %i1, %o1;
87 #define COPY_ARGS_3     COPY_ARGS_2 mov %i2, %o2;
88 #define COPY_ARGS_4     COPY_ARGS_3 mov %i3, %o3;
89 #define COPY_ARGS_5     COPY_ARGS_4 mov %i4, %o4;
90 #define COPY_ARGS_6     COPY_ARGS_5 mov %i5, %o5;
91
92 # ifndef __ASSEMBLER__
93 #  define SINGLE_THREAD_P \
94   __builtin_expect (THREAD_GETMEM (THREAD_SELF,                               \
95                                    header.multiple_threads) == 0, 1)
96 # else
97 #  define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1
98 # endif
99
100 #elif !defined __ASSEMBLER__
101
102 # define SINGLE_THREAD_P (1)
103 # define NO_CANCELLATION 1
104
105 #endif
106
107 #ifndef __ASSEMBLER__
108 # define RTLD_SINGLE_THREAD_P \
109   __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
110                                    header.multiple_threads) == 0, 1)
111 #endif