]> git.ipfire.org Git - thirdparty/glibc.git/blame - nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
Update.
[thirdparty/glibc.git] / nptl / sysdeps / unix / sysv / linux / s390 / s390-32 / sysdep-cancel.h
CommitLineData
a88c9263
UD
1/* Copyright (C) 2003 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
19
20#include <sysdep.h>
21#include <tls.h>
22#ifndef __ASSEMBLER__
23# include <nptl/pthreadP.h>
24#endif
25
7a114794 26#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
a88c9263
UD
27
28# undef PSEUDO
29# define PSEUDO(name, syscall_name, args) \
30 .text; \
31L(pseudo_cancel): \
32 STM_##args \
33 stm %r12,%r15,48(%r15); \
34 lr %r14,%r15; \
35 ahi %r15,-96; \
36 st %r14,0(%r15); \
37 basr %r13,0; \
380: l %r1,1f-0b(%r13); \
39 bas %r14,0(%r1,%r13); \
40 lr %r0,%r2; \
41 LM_##args \
42 DO_CALL(syscall_name, args); \
43 l %r1,2f-0b(%r13); \
44 lr %r12,%r2; \
45 lr %r2,%r0; \
46 bas %r14,0(%r1,%r13); \
47 lr %r2,%r12; \
48 lm %r12,%r15,48+96(%r15); \
49 j L(pseudo_check); \
501: .long CENABLE-0b; \
512: .long CDISABLE-0b; \
52ENTRY(name) \
53 SINGLE_THREAD_P(%r1) \
54 jne L(pseudo_cancel); \
55 DO_CALL(syscall_name, args); \
56L(pseudo_check): \
57 lhi %r4,-4095; \
58 clr %r2,%r4; \
59 jnl SYSCALL_ERROR_LABEL; \
60L(pseudo_end):
61
62# ifdef IS_IN_libpthread
63# define CENABLE __pthread_enable_asynccancel
64# define CDISABLE __pthread_disable_asynccancel
65# else
66# define CENABLE __libc_enable_asynccancel
67# define CDISABLE __libc_disable_asynccancel
68# endif
69
70#define STM_0 /* Nothing */
71#define STM_1 st %r2,8(%r15);
72#define STM_2 stm %r2,%r3,8(%r15);
73#define STM_3 stm %r2,%r4,8(%r15);
74#define STM_4 stm %r2,%r5,8(%r15);
75#define STM_5 stm %r2,%r5,8(%r15);
76
77#define LM_0 /* Nothing */
78#define LM_1 l %r2,8+96(%r15);
79#define LM_2 lm %r2,%r3,8+96(%r15);
80#define LM_3 lm %r2,%r4,8+96(%r15);
81#define LM_4 lm %r2,%r5,8+96(%r15);
82#define LM_5 lm %r2,%r5,8+96(%r15);
83
84# ifndef __ASSEMBLER__
85# define SINGLE_THREAD_P \
86 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
1419a958 87 header.multiple_threads) == 0, 1)
a88c9263
UD
88# else
89# define SINGLE_THREAD_P(reg) \
90 ear reg,%a0; \
91 icm reg,15,MULTIPLE_THREADS_OFFSET(reg);
92# endif
93
94#elif !defined __ASSEMBLER__
95
96/* This code should never be used but we define it anyhow. */
97# define SINGLE_THREAD_P (1)
98
99#endif