1 /* Cancellable system call stubs. Linux/PowerPC64 version.
2 Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Franz Sirl <Franz.Sirl-kernel@lauterbach.com>, 2003.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
23 # include <nptl/pthreadP.h>
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
28 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
29 # define DASHDASHPFX(str) .__##str
31 # define DASHDASHPFX(str) __##str
35 # define PSEUDO(name, syscall_name, args) \
39 bne- .Lpseudo_cancel; \
40 .type DASHDASHPFX(syscall_name##_nocancel),@function; \
41 .globl DASHDASHPFX(syscall_name##_nocancel); \
42 DASHDASHPFX(syscall_name##_nocancel): \
43 DO_CALL (SYS_ify (syscall_name)); \
45 .size DASHDASHPFX(syscall_name##_nocancel),.-DASHDASHPFX(syscall_name##_nocancel); \
48 cfi_adjust_cfa_offset (128); \
51 cfi_offset (lr, 16); \
52 DOCARGS_##args; /* save syscall args around CENABLE. */ \
54 std 3,112(1); /* store CENABLE return value (MASK). */ \
55 UNDOCARGS_##args; /* restore syscall args. */ \
56 DO_CALL (SYS_ify (syscall_name)); \
57 mfcr 0; /* save CR/R3 around CDISABLE. */ \
61 ld 3,112(1); /* pass MASK to CDISABLE. */ \
64 ld 0,128+8(1); /* restore CR/R3. */ \
69 cfi_adjust_cfa_offset (-128); \
76 # define DOCARGS_1 std 3,128+48(1); DOCARGS_0
77 # define UNDOCARGS_1 ld 3,128+48(1); UNDOCARGS_0
79 # define DOCARGS_2 std 4,128+56(1); DOCARGS_1
80 # define UNDOCARGS_2 ld 4,128+56(1); UNDOCARGS_1
82 # define DOCARGS_3 std 5,128+64(1); DOCARGS_2
83 # define UNDOCARGS_3 ld 5,128+64(1); UNDOCARGS_2
85 # define DOCARGS_4 std 6,128+72(1); DOCARGS_3
86 # define UNDOCARGS_4 ld 6,128+72(1); UNDOCARGS_3
88 # define DOCARGS_5 std 7,128+80(1); DOCARGS_4
89 # define UNDOCARGS_5 ld 7,128+80(1); UNDOCARGS_4
91 # define DOCARGS_6 std 8,128+88(1); DOCARGS_5
92 # define UNDOCARGS_6 ld 8,128+88(1); UNDOCARGS_5
94 # ifdef IS_IN_libpthread
96 # define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
97 # define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
99 # define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel); nop
100 # define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel); nop
102 # elif !defined NOT_IN_libc
104 # define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
105 # define CDISABLE bl JUMPTARGET(__libc_disable_asynccancel)
107 # define CENABLE bl JUMPTARGET(__libc_enable_asynccancel); nop
108 # define CDISABLE bl JUMPTARGET(__libc_disable_asynccancel); nop
110 # elif defined IS_IN_librt
112 # define CENABLE bl JUMPTARGET(__librt_enable_asynccancel)
113 # define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel)
115 # define CENABLE bl JUMPTARGET(__librt_enable_asynccancel); nop
116 # define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel); nop
119 # error Unsupported library
122 # ifndef __ASSEMBLER__
123 # define SINGLE_THREAD_P \
124 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
125 header.multiple_threads) == 0, 1)
127 # define SINGLE_THREAD_P \
128 lwz 10,MULTIPLE_THREADS_OFFSET(13); \
132 #elif !defined __ASSEMBLER__
134 # define SINGLE_THREAD_P (1)
135 # define NO_CANCELLATION 1
139 #ifndef __ASSEMBLER__
140 # define RTLD_SINGLE_THREAD_P \
141 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
142 header.multiple_threads) == 0, 1)