|
Packit |
6c4009 |
/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, January 1997.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _LINUX_SPARC32_SYSDEP_H
|
|
Packit |
6c4009 |
#define _LINUX_SPARC32_SYSDEP_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <sysdeps/unix/sysv/linux/sparc/sysdep.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if IS_IN (rtld)
|
|
Packit |
6c4009 |
# include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
#include <tls.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef SYS_ify
|
|
Packit |
6c4009 |
#define SYS_ify(syscall_name) __NR_##syscall_name
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifdef __ASSEMBLER__
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define LOADSYSCALL(x) mov __NR_##x, %g1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef PSEUDO
|
|
Packit |
6c4009 |
#define PSEUDO(name, syscall_name, args) \
|
|
Packit |
6c4009 |
.text; \
|
|
Packit |
6c4009 |
ENTRY(name); \
|
|
Packit |
6c4009 |
LOADSYSCALL(syscall_name); \
|
|
Packit |
6c4009 |
ta 0x10; \
|
|
Packit |
6c4009 |
bcc 1f; \
|
|
Packit |
6c4009 |
nop; \
|
|
Packit |
6c4009 |
SYSCALL_ERROR_HANDLER \
|
|
Packit |
6c4009 |
1:
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef PSEUDO_NOERRNO
|
|
Packit |
6c4009 |
#define PSEUDO_NOERRNO(name, syscall_name, args)\
|
|
Packit |
6c4009 |
.text; \
|
|
Packit |
6c4009 |
ENTRY(name); \
|
|
Packit |
6c4009 |
LOADSYSCALL(syscall_name); \
|
|
Packit |
6c4009 |
ta 0x10;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef PSEUDO_ERRVAL
|
|
Packit |
6c4009 |
#define PSEUDO_ERRVAL(name, syscall_name, args) \
|
|
Packit |
6c4009 |
.text; \
|
|
Packit |
6c4009 |
ENTRY(name); \
|
|
Packit |
6c4009 |
LOADSYSCALL(syscall_name); \
|
|
Packit |
6c4009 |
ta 0x10;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#undef PSEUDO_END
|
|
Packit |
6c4009 |
#define PSEUDO_END(name) \
|
|
Packit |
6c4009 |
END(name)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef PIC
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_HANDLER \
|
|
Packit |
6c4009 |
mov %o7, %g1; \
|
|
Packit |
6c4009 |
call __syscall_error; \
|
|
Packit |
6c4009 |
mov %g1, %o7;
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# if RTLD_PRIVATE_ERRNO
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_HANDLER \
|
|
Packit |
6c4009 |
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
|
Packit |
6c4009 |
sethi %gdop_hix22(rtld_errno), %g1; \
|
|
Packit |
6c4009 |
xor %g1, %gdop_lox10(rtld_errno), %g1;\
|
|
Packit |
6c4009 |
ld [%o2 + %g1], %g1, %gdop(rtld_errno); \
|
|
Packit |
6c4009 |
st %o0, [%g1]; \
|
|
Packit |
6c4009 |
jmp %o7 + 8; \
|
|
Packit |
6c4009 |
mov -1, %o0;
|
|
Packit |
6c4009 |
# elif defined _LIBC_REENTRANT
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# if IS_IN (libc)
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_ERRNO __libc_errno
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_ERRNO errno
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_HANDLER \
|
|
Packit |
6c4009 |
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
|
Packit |
6c4009 |
sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \
|
|
Packit |
6c4009 |
add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \
|
|
Packit |
6c4009 |
ld [%o2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO); \
|
|
Packit |
6c4009 |
st %o0, [%g7 + %g1]; \
|
|
Packit |
6c4009 |
jmp %o7 + 8; \
|
|
Packit |
6c4009 |
mov -1, %o0;
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define SYSCALL_ERROR_HANDLER \
|
|
Packit |
6c4009 |
0: SETUP_PIC_REG_LEAF(o2,g1) \
|
|
Packit |
6c4009 |
sethi %gdop_hix22(errno), %g1;\
|
|
Packit |
6c4009 |
xor %g1, %gdop_lox10(errno), %g1;\
|
|
Packit |
6c4009 |
ld [%o2 + %g1], %g1, %gdop(errno);\
|
|
Packit |
6c4009 |
st %o0, [%g1]; \
|
|
Packit |
6c4009 |
jmp %o7 + 8; \
|
|
Packit |
6c4009 |
mov -1, %o0;
|
|
Packit |
6c4009 |
# endif /* _LIBC_REENTRANT */
|
|
Packit |
6c4009 |
#endif /* PIC */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#else /* __ASSEMBLER__ */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __SYSCALL_STRING \
|
|
Packit |
6c4009 |
"ta 0x10;" \
|
|
Packit |
6c4009 |
"bcc 1f;" \
|
|
Packit |
6c4009 |
" mov 0, %%g1;" \
|
|
Packit |
6c4009 |
"sub %%g0, %%o0, %%o0;" \
|
|
Packit |
6c4009 |
"mov 1, %%g1;" \
|
|
Packit |
6c4009 |
"1:"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __SYSCALL_CLOBBERS \
|
|
Packit |
6c4009 |
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \
|
|
Packit |
6c4009 |
"f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
|
|
Packit |
6c4009 |
"f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \
|
|
Packit |
6c4009 |
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", \
|
|
Packit |
6c4009 |
"cc", "memory"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* __ASSEMBLER__ */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Pointer mangling support. */
|
|
Packit |
6c4009 |
#if IS_IN (rtld)
|
|
Packit |
6c4009 |
/* We cannot use the thread descriptor because in ld.so we use setjmp
|
|
Packit |
6c4009 |
earlier than the descriptor is initialized. */
|
|
Packit |
6c4009 |
#else
|
|
Packit |
6c4009 |
# ifdef __ASSEMBLER__
|
|
Packit |
6c4009 |
# define PTR_MANGLE(dreg, reg, tmpreg) \
|
|
Packit |
6c4009 |
ld [%g7 + POINTER_GUARD], tmpreg; \
|
|
Packit |
6c4009 |
xor reg, tmpreg, dreg
|
|
Packit |
6c4009 |
# define PTR_DEMANGLE(dreg, reg, tmpreg) PTR_MANGLE (dreg, reg, tmpreg)
|
|
Packit |
6c4009 |
# define PTR_MANGLE2(dreg, reg, tmpreg) \
|
|
Packit |
6c4009 |
xor reg, tmpreg, dreg
|
|
Packit |
6c4009 |
# define PTR_DEMANGLE2(dreg, reg, tmpreg) PTR_MANGLE2 (dreg, reg, tmpreg)
|
|
Packit |
6c4009 |
# else
|
|
Packit |
6c4009 |
# define PTR_MANGLE(var) \
|
|
Packit |
6c4009 |
(var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
|
|
Packit |
6c4009 |
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
|
|
Packit |
6c4009 |
# endif
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* linux/sparc/sysdep.h */
|