1 /* Copyright (C) 1997-2023 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
18 #ifndef _LINUX_SPARC64_SYSDEP_H
19 #define _LINUX_SPARC64_SYSDEP_H 1
21 #include <sysdeps/unix/sysv/linux/sparc/sysdep.h>
24 # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
29 #define SYS_ify(syscall_name) __NR_##syscall_name
33 #define LOADSYSCALL(x) mov __NR_##x, %g1
36 #define PSEUDO(name, syscall_name, args) \
39 LOADSYSCALL(syscall_name); \
43 SYSCALL_ERROR_HANDLER \
47 #define PSEUDO_NOERRNO(name, syscall_name, args)\
50 LOADSYSCALL(syscall_name); \
54 #define PSEUDO_ERRVAL(name, syscall_name, args) \
57 LOADSYSCALL(syscall_name); \
61 #define PSEUDO_END(name) \
65 # define SYSCALL_ERROR_HANDLER \
67 call __syscall_error; \
70 # if RTLD_PRIVATE_ERRNO
71 # define SYSCALL_ERROR_HANDLER \
72 0: SETUP_PIC_REG_LEAF(o2,g1) \
73 sethi %gdop_hix22(rtld_errno), %g1; \
74 xor %g1, %gdop_lox10(rtld_errno), %g1;\
75 ldx [%o2 + %g1], %g1, %gdop(rtld_errno); \
79 # elif defined _LIBC_REENTRANT
82 # define SYSCALL_ERROR_ERRNO __libc_errno
84 # define SYSCALL_ERROR_ERRNO errno
86 # define SYSCALL_ERROR_HANDLER \
87 0: SETUP_PIC_REG_LEAF(o2,g1) \
88 sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
89 add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
90 ldx [%o2 + %g1], %g1, %tie_ldx(SYSCALL_ERROR_ERRNO);\
91 st %o0, [%g7 + %g1]; \
95 # define SYSCALL_ERROR_HANDLER \
96 0: SETUP_PIC_REG_LEAF(o2,g1) \
97 sethi %gdop_hix22(errno), %g1;\
98 xor %g1, %gdop_lox10(errno), %g1;\
99 ldx [%o2 + %g1], %g1, %gdop(errno);\
103 # endif /* _LIBC_REENTRANT */
106 #else /* __ASSEMBLER__ */
108 #define __SYSCALL_STRING \
110 "bcc,pt %%xcc, 1f;" \
112 "sub %%g0, %%o0, %%o0;" \
115 #define __SYSCALL_CLOBBERS \
116 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
117 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
118 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
119 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
120 "f32", "f34", "f36", "f38", "f40", "f42", "f44", "f46", \
121 "f48", "f50", "f52", "f54", "f56", "f58", "f60", "f62", \
124 #endif /* __ASSEMBLER__ */
126 /* This is the offset from the %sp to the backing store above the
127 register windows. So if you poke stack memory directly you add this. */
128 #define STACK_BIAS 2047
130 #endif /* linux/sparc64/sysdep.h */