1 /* Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
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
20 #ifndef _LINUX_SPARC32_SYSDEP_H
21 #define _LINUX_SPARC32_SYSDEP_H 1
23 #include <sysdeps/unix/sparc/sysdep.h>
26 # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
31 #define SYS_ify(syscall_name) __NR_##syscall_name
35 #define LOADSYSCALL(x) mov __NR_##x, %g1
37 /* Linux/SPARC uses a different trap number */
48 .global C_SYMBOL_NAME(name); \
49 .type name, @function; \
57 #define LOC(name) .L##name
59 /* If the offset to __syscall_error fits into a signed 22-bit
60 * immediate branch offset, the linker will relax the call into
63 #define PSEUDO(name, syscall_name, args) \
65 .globl __syscall_error; \
67 LOADSYSCALL(syscall_name); \
71 call __syscall_error; \
75 #define PSEUDO_NOERRNO(name, syscall_name, args)\
78 LOADSYSCALL(syscall_name); \
81 #define PSEUDO_ERRVAL(name, syscall_name, args) \
84 LOADSYSCALL(syscall_name); \
87 #define PSEUDO_END(name) \
90 #else /* __ASSEMBLER__ */
92 #define __SYSCALL_STRING \
99 "save %%sp, -192, %%sp;" \
100 "call __errno_location;" \
104 " restore %%g0, -1, %%o0;" \
107 #define __CLONE_SYSCALL_STRING \
110 " sub %%o1, 1, %%o1;" \
111 "and %%o0, %%o1, %%o0;" \
115 "save %%sp, -192, %%sp;" \
116 "call __errno_location;" \
120 " restore %%g0, -1, %%o0;" \
123 #define __INTERNAL_SYSCALL_STRING \
126 " sub %%g0, %%o0, %%o0;" \
129 #define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \
130 "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
131 "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
132 "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
133 "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
136 #include <sysdeps/unix/sysv/linux/sparc/sysdep.h>
138 #endif /* __ASSEMBLER__ */
140 /* Pointer mangling support. */
141 #if defined NOT_IN_libc && defined IS_IN_rtld
142 /* We cannot use the thread descriptor because in ld.so we use setjmp
143 earlier than the descriptor is initialized. */
145 # ifdef __ASSEMBLER__
146 # define PTR_MANGLE(dreg, reg, tmpreg) \
147 ld [%g7 + POINTER_GUARD], tmpreg; \
148 xor reg, tmpreg, dreg
149 # define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
150 # define PTR_MANGLE2(dreg, reg, tmpreg) \
151 xor reg, tmpreg, dreg
152 # define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
154 # define PTR_MANGLE(var) \
155 (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
156 # define PTR_DEMANGLE(var) PTR_MANGLE (var)
160 #endif /* linux/sparc/sysdep.h */