~ubuntu-branches/ubuntu/utopic/eglibc/utopic

« back to all changes in this revision

Viewing changes to ports/sysdeps/unix/bsd/bsd4.4/kfreebsd/x86_64/linuxthreads/sysdep-cancel.h

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-10-26 05:14:58 UTC
  • mfrom: (1.5.1) (4.4.22 experimental)
  • Revision ID: package-import@ubuntu.com-20121026051458-oryotr4i03ob5pab
Tags: 2.16-0ubuntu1
* Merge with unreleased 2.16 in Debian experimental, remaining changes:
  - Drop the Breaks line from libc6, which refers to a Debian transition
  - Remove the libc6 recommends on libc6-i686, which we don't build
  - Enable libc6{,-dev}-armel on armhf and libc6{-dev}-armhf on armel
  - Ship update-locale and validlocale in /usr/sbin in libc-bin
  - Don't build locales or locales-all in Ubuntu, we rely on langpacks
  - Heavily mangle the way we do service restarting on major upgrades
  - Use different MIN_KERNEL_SUPPORTED versions than Debian, due to
    buildd needs.  This should be universally bumped to 3.2.0 once all
    our buildds (including the PPA guests) are running precise kernels
  - Build i386 variants as -march=i686, build amd64 with -O3, and build
    ppc64 variants (both 64-bit and 32-bit) with -O3 -fno-tree-vectorize
  - Re-enable unsubmitted-ldconfig-cache-abi.diff and rebuild the cache
    on upgrades from previous versions that used a different constant
  - debian/patches/any/local-CVE-2012-3406.diff: switch to malloc when
    array grows too large to handle via alloca extension (CVE-2012-3406)
  - Build generic i386/i686 flavour with -mno-tls-direct-seg-refs
* Changes added/dropped with this merge while reducing our delta:
  - Stop building glibc docs from the eglibc source, and instead make
    the glibc-docs stub have a hard dependency on glibc-doc-reference
  - Remove outdated conflicts against ancient versions of ia32-libs
  - Drop the tzdata dependency from libc6, it's in required and minimal
  - Use gcc-4.7/g++-4.7 by default on all our supported architectures
  - Save our historical changelog as changelog.ubuntu in the source
  - Drop nscd's libaudit build-dep for now, as libaudit is in universe
  - Drop the unnecessary Breaks from libc6 to locales and locales-all
  - Ship xen's ld.so.conf.d snippet as /etc/ld.so.conf.d/libc6-xen.conf
* Disable hard failures on the test suite for the first upload to raring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
2
   This file is part of the GNU C Library.
 
3
   Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
 
4
   Modification for FreeBSD contributed by Petr Salinger, 2006.
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
16
   You should have received a copy of the GNU Lesser General Public
 
17
   License along with the GNU C Library; if not, write to the Free
 
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
19
   02111-1307 USA.  */
 
20
 
 
21
#include <sysdep.h>
 
22
#include <tls.h>
 
23
#include <pt-machine.h>
 
24
#ifndef __ASSEMBLER__
 
25
# include <linuxthreads/internals.h>
 
26
#endif
 
27
 
 
28
/* Syscalls with more than 6 arguments are not supported here.  */
 
29
 
 
30
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
 
31
 
 
32
# undef PSEUDO
 
33
# define PSEUDO(name, syscall_name, args)                                     \
 
34
  .text;                                                                      \
 
35
  ENTRY (name)                                                                \
 
36
    SINGLE_THREAD_P;                                                          \
 
37
    jne L(pseudo_cancel);                                                     \
 
38
    DO_CALL (syscall_name, args);                                             \
 
39
    jb SYSCALL_ERROR_LABEL;                                                   \
 
40
    ret;                                                                      \
 
41
  L(pseudo_cancel):                                                           \
 
42
    /* Save registers that might get destroyed.  */                           \
 
43
    SAVESTK_##args                                                            \
 
44
    PUSHARGS_##args                                                           \
 
45
    CENABLE                                                                   \
 
46
    /* Restore registers.  */                                                 \
 
47
    POPARGS_##args                                                            \
 
48
    RESTSTK_##args                                                            \
 
49
    /* The return value from CENABLE is argument for CDISABLE.  */            \
 
50
    movq %rax, (%rsp);                                                        \
 
51
    movl $SYS_ify (syscall_name), %eax;                                       \
 
52
    syscall;                                                                  \
 
53
    popq %rdi; cfi_adjust_cfa_offset(-8);                                     \
 
54
    pushfq; cfi_adjust_cfa_offset(8);                                         \
 
55
    /* Save %rax since it's the return/error code from the syscall.  */       \
 
56
    movq %rax, 8(%rsp);                                                       \
 
57
    CDISABLE                                                                  \
 
58
    popfq; cfi_adjust_cfa_offset(-8);                                         \
 
59
    /* fetch the error code from the syscall.  */                             \
 
60
    popq %rax; cfi_adjust_cfa_offset(-8);                                     \
 
61
    /* adjust rsp, do not change flags  */                                    \
 
62
    popq %rdx; cfi_adjust_cfa_offset(-8);                                     \
 
63
    jb SYSCALL_ERROR_LABEL;                                                   \
 
64
  L(pseudo_end):
 
65
 
 
66
# define PUSHARGS_0     /* Nothing.  */
 
67
# define PUSHARGS_1     PUSHARGS_0 movq %rdi, 8(%rsp);
 
68
# define PUSHARGS_2     PUSHARGS_1 movq %rsi, 16(%rsp);
 
69
# define PUSHARGS_3     PUSHARGS_2 movq %rdx, 24(%rsp);
 
70
# define PUSHARGS_4     PUSHARGS_3 movq %rcx, 32(%rsp);
 
71
# define PUSHARGS_5     PUSHARGS_4 movq %r8, 40(%rsp);
 
72
# define PUSHARGS_6     PUSHARGS_5 movq %r9, 48(%rsp);
 
73
 
 
74
# define POPARGS_0      /* Nothing.  */
 
75
# define POPARGS_1      POPARGS_0 movq 8(%rsp), %rdi;
 
76
# define POPARGS_2      POPARGS_1 movq 16(%rsp), %rsi;
 
77
# define POPARGS_3      POPARGS_2 movq 24(%rsp), %rdx;
 
78
# define POPARGS_4      POPARGS_3 movq 32(%rsp), %r10;
 
79
# define POPARGS_5      POPARGS_4 movq 40(%rsp), %r8;
 
80
# define POPARGS_6      POPARGS_5 movq 48(%rsp), %r9;
 
81
 
 
82
/* We always have to align the stack before calling a function.  */
 
83
# define SAVESTK_0      subq $24, %rsp;cfi_adjust_cfa_offset(24);
 
84
# define SAVESTK_1      SAVESTK_0
 
85
# define SAVESTK_2      SAVESTK_1
 
86
# define SAVESTK_3      subq $40, %rsp;cfi_adjust_cfa_offset(40);
 
87
# define SAVESTK_4      SAVESTK_3
 
88
# define SAVESTK_5      subq $56, %rsp;cfi_adjust_cfa_offset(56);
 
89
# define SAVESTK_6      SAVESTK_5
 
90
 
 
91
# define RESTSTK_0      /* Nothing.  */
 
92
# define RESTSTK_1      RESTSTK_0
 
93
# define RESTSTK_2      RESTSTK_1
 
94
# define RESTSTK_3      addq $16, %rsp;cfi_adjust_cfa_offset(-16);
 
95
# define RESTSTK_4      RESTSTK_3
 
96
# define RESTSTK_5      addq $32, %rsp;cfi_adjust_cfa_offset(-32);
 
97
# define RESTSTK_6      RESTSTK_5
 
98
 
 
99
# ifdef IS_IN_libpthread
 
100
#  define CENABLE       call __pthread_enable_asynccancel;
 
101
#  define CDISABLE      call __pthread_disable_asynccancel;
 
102
#  define __local_multiple_threads __pthread_multiple_threads
 
103
# elif !defined NOT_IN_libc
 
104
#  define CENABLE       call __libc_enable_asynccancel;
 
105
#  define CDISABLE      call __libc_disable_asynccancel;
 
106
#  define __local_multiple_threads __libc_multiple_threads
 
107
# else
 
108
#  define CENABLE       call __librt_enable_asynccancel@plt;
 
109
#  define CDISABLE      call __librt_disable_asynccancel@plt;
 
110
# endif
 
111
 
 
112
# if defined IS_IN_libpthread || !defined NOT_IN_libc
 
113
#  ifndef __ASSEMBLER__
 
114
extern int __local_multiple_threads attribute_hidden;
 
115
#   define SINGLE_THREAD_P \
 
116
  __builtin_expect (__local_multiple_threads == 0, 1)
 
117
#  else
 
118
#   define SINGLE_THREAD_P cmpl $0, __local_multiple_threads(%rip)
 
119
#  endif
 
120
 
 
121
# else
 
122
 
 
123
#  ifndef __ASSEMBLER__
 
124
#   define SINGLE_THREAD_P \
 
125
  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
 
126
                                   p_header.data.multiple_threads) == 0, 1)
 
127
#  else
 
128
#   define SINGLE_THREAD_P cmpl $0, %fs:MULTIPLE_THREADS_OFFSET
 
129
#  endif
 
130
 
 
131
# endif
 
132
 
 
133
#elif !defined __ASSEMBLER__
 
134
 
 
135
/* This code should never be used but we define it anyhow.  */
 
136
# define SINGLE_THREAD_P (1)
 
137
# define NO_CANCELLATION 1
 
138
 
 
139
#endif
 
140
 
 
141
#ifndef __ASSEMBLER__
 
142
# define RTLD_SINGLE_THREAD_P \
 
143
  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
 
144
                                     p_header.data.multiple_threads) == 0, 1)
 
145
#endif