]> sourceware.org Git - glibc.git/blob - nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
Update.
[glibc.git] / nptl / sysdeps / unix / sysv / linux / i386 / sysdep-cancel.h
1 /* Copyright (C) 2002 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, 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
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread
27
28 # undef PSEUDO
29 # define PSEUDO(name, syscall_name, args) \
30 .text; \
31 ENTRY (name) \
32 cmpl $0, %gs:MULTIPLE_THREADS_OFFSET; \
33 jne L(pseudo_cancel); \
34 DO_CALL (syscall_name, args); \
35 cmpl $-4095, %eax; \
36 jae SYSCALL_ERROR_LABEL; \
37 ret; \
38 L(pseudo_cancel): \
39 CENABLE \
40 SAVE_OLDTYPE_##args \
41 PUSHARGS_##args \
42 DOCARGS_##args \
43 movl $SYS_ify (syscall_name), %eax; \
44 int $0x80 \
45 POPARGS_##args; \
46 POPCARGS_##args \
47 cmpl $-4095, %eax; \
48 jae SYSCALL_ERROR_LABEL; \
49 L(pseudo_end):
50
51 # define SAVE_OLDTYPE_0 movl %eax, %edx;
52 # define SAVE_OLDTYPE_1 SAVE_OLDTYPE_0
53 # define SAVE_OLDTYPE_2 pushl %eax;
54 # define SAVE_OLDTYPE_3 SAVE_OLDTYPE_2
55 # define SAVE_OLDTYPE_4 SAVE_OLDTYPE_2
56 # define SAVE_OLDTYPE_5 SAVE_OLDTYPE_2
57
58 # define DOCARGS_0 DOARGS_0
59 # define DOCARGS_1 DOARGS_1
60 # define DOCARGS_2 _DOARGS_2 (12)
61 # define DOCARGS_3 _DOARGS_3 (20)
62 # define DOCARGS_4 _DOARGS_4 (28)
63 # define DOCARGS_5 _DOARGS_5 (36)
64
65 # ifdef IS_IN_libpthread
66 # define CENABLE call __pthread_enable_asynccancel;
67 # define CDISABLE call __pthread_disable_asynccancel
68 # else
69 # define CENABLE call __libc_enable_asynccancel;
70 # define CDISABLE call __libc_disable_asynccancel
71 # endif
72 # define POPCARGS_0 pushl %eax; movl %ecx, %eax; CDISABLE; popl %eax;
73 # define POPCARGS_1 POPCARGS_0
74 # define POPCARGS_2 xchgl (%esp), %eax; CDISABLE; popl %eax;
75 # define POPCARGS_3 POPCARGS_2
76 # define POPCARGS_4 POPCARGS_2
77 # define POPCARGS_5 POPCARGS_2
78
79 # ifndef ASSEMBLER
80 # define SINGLE_THREAD_P \
81 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
82 header.data.multiple_threads) == 0, 1)
83 # else
84 # define SINGLE_THREAD_P cmpl $0, %gs:MULTIPLE_THREADS_OFFSET
85 # endif
86
87 #elif !defined ASSEMBLER
88
89 /* This code should never be used but we define it anyhow. */
90 # define SINGLE_THREAD_P (1)
91
92 #endif
This page took 0.046536 seconds and 6 git commands to generate.