]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / sparc / sparc32 / sysdep.h
CommitLineData
d4697bc9 1/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
fd26970f
UD
2 This file is part of the GNU C Library.
3 Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
fd26970f
UD
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
41bdb6e2 13 Lesser General Public License for more details.
fd26970f 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
fd26970f 18
4d76a0ec
UD
19#ifndef _LINUX_SPARC32_SYSDEP_H
20#define _LINUX_SPARC32_SYSDEP_H 1
fd26970f 21
aab39a09 22#include <sysdeps/unix/sysv/linux/sparc/sysdep.h>
fd26970f 23
369b849f
RM
24#ifdef IS_IN_rtld
25# include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
26#endif
137ffcdc 27#include <tls.h>
369b849f 28
fd26970f
UD
29#undef SYS_ify
30#define SYS_ify(syscall_name) __NR_##syscall_name
31
66715f83 32#ifdef __ASSEMBLER__
fd26970f 33
131fd126 34#define LOADSYSCALL(x) mov __NR_##x, %g1
fd26970f 35
fd26970f 36#undef PSEUDO
043cee37
RM
37#define PSEUDO(name, syscall_name, args) \
38 .text; \
043cee37
RM
39ENTRY(name); \
40 LOADSYSCALL(syscall_name); \
41 ta 0x10; \
42 bcc 1f; \
3ba57516
DM
43 nop; \
44 SYSCALL_ERROR_HANDLER \
043cee37
RM
451:
46
aab39a09 47#undef PSEUDO_NOERRNO
043cee37
RM
48#define PSEUDO_NOERRNO(name, syscall_name, args)\
49 .text; \
50ENTRY(name); \
51 LOADSYSCALL(syscall_name); \
52 ta 0x10;
53
aab39a09 54#undef PSEUDO_ERRVAL
043cee37
RM
55#define PSEUDO_ERRVAL(name, syscall_name, args) \
56 .text; \
57ENTRY(name); \
58 LOADSYSCALL(syscall_name); \
59 ta 0x10;
60
aab39a09 61#undef PSEUDO_END
043cee37
RM
62#define PSEUDO_END(name) \
63 END(name)
137ffcdc 64
3ba57516
DM
65#ifndef PIC
66# define SYSCALL_ERROR_HANDLER \
67 mov %o7, %g1; \
68 call __syscall_error; \
69 mov %g1, %o7;
5e6f34c2 70#else
3ba57516 71# if RTLD_PRIVATE_ERRNO
53362a4b 72# define SYSCALL_ERROR_HANDLER \
3d2b3019
DM
730: SETUP_PIC_REG_LEAF(o2,g1) \
74 sethi %gdop_hix22(rtld_errno), %g1; \
75 xor %g1, %gdop_lox10(rtld_errno), %g1;\
76 ld [%o2 + %g1], %g1, %gdop(rtld_errno); \
77 st %o0, [%g1]; \
78 jmp %o7 + 8; \
79 mov -1, %o0;
3ba57516
DM
80# elif defined _LIBC_REENTRANT
81
d063d164
UD
82# ifndef NOT_IN_libc
83# define SYSCALL_ERROR_ERRNO __libc_errno
84# else
85# define SYSCALL_ERROR_ERRNO errno
86# endif
dd54084d
DM
87# define SYSCALL_ERROR_HANDLER \
880: SETUP_PIC_REG_LEAF(o2,g1) \
3ba57516
DM
89 sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
90 add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
91 ld [%o2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO); \
d063d164
UD
92 st %o0, [%g7 + %g1]; \
93 jmp %o7 + 8; \
3ba57516 94 mov -1, %o0;
3ba57516 95# else
53362a4b 96# define SYSCALL_ERROR_HANDLER \
3d2b3019
DM
970: SETUP_PIC_REG_LEAF(o2,g1) \
98 sethi %gdop_hix22(errno), %g1;\
99 xor %g1, %gdop_lox10(errno), %g1;\
100 ld [%o2 + %g1], %g1, %gdop(errno);\
101 st %o0, [%g1]; \
102 jmp %o7 + 8; \
103 mov -1, %o0;
3ba57516
DM
104# endif /* _LIBC_REENTRANT */
105#endif /* PIC */
106
107
108#else /* __ASSEMBLER__ */
5e6f34c2 109
4d76a0ec
UD
110#define __SYSCALL_STRING \
111 "ta 0x10;" \
3ba57516
DM
112 "bcc 1f;" \
113 " mov 0, %%g1;" \
114 "sub %%g0, %%o0, %%o0;" \
115 "mov 1, %%g1;" \
369b849f
RM
116 "1:"
117
86746abb 118#define __SYSCALL_CLOBBERS \
4d76a0ec
UD
119 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
120 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
121 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
122 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
123 "cc", "memory"
124
66715f83 125#endif /* __ASSEMBLER__ */
fd26970f 126
305bb37e
UD
127/* Pointer mangling support. */
128#if defined NOT_IN_libc && defined IS_IN_rtld
129/* We cannot use the thread descriptor because in ld.so we use setjmp
130 earlier than the descriptor is initialized. */
131#else
132# ifdef __ASSEMBLER__
133# define PTR_MANGLE(dreg, reg, tmpreg) \
134 ld [%g7 + POINTER_GUARD], tmpreg; \
135 xor reg, tmpreg, dreg
136# define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
137# define PTR_MANGLE2(dreg, reg, tmpreg) \
138 xor reg, tmpreg, dreg
139# define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
140# else
141# define PTR_MANGLE(var) \
142 (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
143# define PTR_DEMANGLE(var) PTR_MANGLE (var)
144# endif
145#endif
146
fd26970f 147#endif /* linux/sparc/sysdep.h */