(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / nptl / sysdeps / unix / sysv / linux / sparc / sparc32 / sysdep-cancel.h
blob5edf4b3772f11773c612ba93f48745570884adc3
1 /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
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.
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.
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. */
20 #include <sysdep.h>
21 #include <tls.h>
22 #ifndef __ASSEMBLER__
23 # include <nptl/pthreadP.h>
24 #endif
26 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
28 # undef PSEUDO
29 # define PSEUDO(name, syscall_name, args) \
30 .text; \
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 bcs __syscall_error_handler; \
41 nop; \
42 .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
43 .subsection 2; \
44 cfi_startproc; \
45 1: save %sp, -96, %sp; \
46 cfi_def_cfa_register (%fp); \
47 cfi_window_save; \
48 cfi_register (%o7, %i7); \
49 CENABLE; \
50 nop; \
51 mov %o0, %l0; \
52 COPY_ARGS_##args \
53 mov SYS_ify(syscall_name), %g1; \
54 ta 0x10; \
55 bcs __syscall_error_handler2; \
56 mov %o0, %l1; \
57 CDISABLE; \
58 mov %l0, %o0; \
59 jmpl %i7 + 8, %g0; \
60 restore %g0, %l1, %o0; \
61 cfi_endproc; \
62 .previous; \
63 SYSCALL_ERROR_HANDLER \
64 SYSCALL_ERROR_HANDLER2
66 #define SYSCALL_ERROR_HANDLER2 \
67 SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2) \
68 .global __errno_location; \
69 .type __errno_location,@function; \
70 CDISABLE; \
71 mov %l0, %o0; \
72 call __errno_location; \
73 nop; \
74 st %l1, [%o0]; \
75 jmpl %i7 + 8, %g0; \
76 restore %g0, -1, %o0; \
77 .previous;
79 # ifdef IS_IN_libpthread
80 # define CENABLE call __pthread_enable_asynccancel
81 # define CDISABLE call __pthread_disable_asynccancel
82 # elif !defined NOT_IN_libc
83 # define CENABLE call __libc_enable_asynccancel
84 # define CDISABLE call __libc_disable_asynccancel
85 # elif defined IS_IN_librt
86 # define CENABLE call __librt_enable_asynccancel
87 # define CDISABLE call __librt_disable_asynccancel
88 # else
89 # error Unsupported library
90 # endif
92 #define COPY_ARGS_0 /* Nothing */
93 #define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0;
94 #define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1;
95 #define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2;
96 #define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3;
97 #define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4;
98 #define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5;
100 # ifndef __ASSEMBLER__
101 # define SINGLE_THREAD_P \
102 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
103 header.multiple_threads) == 0, 1)
104 # else
105 # define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1
106 # endif
108 #elif !defined __ASSEMBLER__
110 # define SINGLE_THREAD_P (1)
111 # define NO_CANCELLATION 1
113 #endif