]> git.ipfire.org Git - thirdparty/glibc.git/blame - linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep-cancel.h
Update.
[thirdparty/glibc.git] / linuxthreads / sysdeps / unix / sysv / linux / sparc / sparc32 / sysdep-cancel.h
CommitLineData
62f29da7 1/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
131fd126
UD
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>
a4baf360 22#ifndef __ASSEMBLER__
131fd126
UD
23# include <linuxthreads/internals.h>
24#endif
25
131fd126
UD
26#if !defined NOT_IN_libc || defined IS_IN_libpthread
27
28# undef PSEUDO
29# define PSEUDO(name, syscall_name, args) \
30 .text; \
31ENTRY(name) \
62f29da7 32 ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1; \
131fd126
UD
33 cmp %g1, 0; \
34 bne 1f; \
35 mov SYS_ify(syscall_name), %g1; \
36 ta 0x10; \
37 bcs __syscall_error_handler; \
38 nop; \
39 .subsection 2; \
401: save %sp, -96, %sp; \
41 CENABLE; \
42 nop; \
43 mov %o0, %l0; \
44 COPY_ARGS_##args \
45 mov SYS_ify(syscall_name), %g1; \
46 ta 0x10; \
47 bcs __syscall_error_handler2; \
48 mov %o0, %l1; \
49 CDISABLE; \
50 mov %l0, %o0; \
51 jmpl %i7 + 8, %g0; \
52 restore %g0, %l1, %o0; \
53 .previous; \
54 SYSCALL_ERROR_HANDLER \
55 SYSCALL_ERROR_HANDLER2
56
57#define SYSCALL_ERROR_HANDLER2 \
58SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler2) \
59 .global __errno_location; \
60 .type __errno_location,@function; \
61 call __errno_location; \
62 nop; \
63 st %l1, [%o0]; \
64 jmpl %i7 + 8, %g0; \
65 restore %g0, -1, %o0; \
66 .previous;
67
68# ifdef IS_IN_libpthread
69# define CENABLE call __pthread_enable_asynccancel
70# define CDISABLE call __pthread_disable_asynccancel
71# else
72# define CENABLE call __libc_enable_asynccancel
73# define CDISABLE call __libc_disable_asynccancel
74# endif
75
76#define COPY_ARGS_0 /* Nothing */
77#define COPY_ARGS_1 COPY_ARGS_0 mov %i0, %o0;
78#define COPY_ARGS_2 COPY_ARGS_1 mov %i1, %o1;
79#define COPY_ARGS_3 COPY_ARGS_2 mov %i2, %o2;
80#define COPY_ARGS_4 COPY_ARGS_3 mov %i3, %o3;
81#define COPY_ARGS_5 COPY_ARGS_4 mov %i4, %o4;
82#define COPY_ARGS_6 COPY_ARGS_5 mov %i5, %o5;
83
a4baf360 84# ifndef __ASSEMBLER__
131fd126
UD
85# define SINGLE_THREAD_P \
86 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
87 p_header.data.multiple_threads) == 0, 1)
88# else
62f29da7 89# define SINGLE_THREAD_P ld [%g7 + MULTIPLE_THREADS_OFFSET], %g1
131fd126
UD
90# endif
91
a4baf360 92#elif !defined __ASSEMBLER__
131fd126
UD
93
94/* This code should never be used but we define it anyhow. */
95# define SINGLE_THREAD_P (1)
96
97#endif