2021-01-02 19:32:25 +00:00
|
|
|
/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
2012-04-17 02:02:27 +00:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
|
|
|
|
Based on code originally written by David Mosberger-Tang
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-04-17 02:10:24 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
2012-04-17 02:02:27 +00:00
|
|
|
|
|
|
|
#ifndef _LINUX_IA64_SYSDEP_H
|
|
|
|
#define _LINUX_IA64_SYSDEP_H 1
|
|
|
|
|
|
|
|
#include <sysdeps/unix/sysdep.h>
|
Add INLINE_SYSCALL_ERROR_RETURN_VALUE
For ia32 PIC, the first thing of many syscalls does is to call
__x86.get_pc_thunk.reg to load PC into reg in case there is an error,
which is required for setting errno. In most cases, there are no
errors. But we still call __x86.get_pc_thunk.reg. This patch adds
INLINE_SYSCALL_ERROR_RETURN_VALUE so that i386 can optimize setting
errno by branching to the internal __syscall_error without PLT.
With i386 INLINE_SYSCALL_ERROR_RETURN_VALUE and i386 syscall inlining
optimization for GCC 5, for sysdeps/unix/sysv/linux/fchmodat.c with
-O2 -march=i686 -mtune=generic, GCC 5.2 now generates:
<fchmodat>:
0: push %ebx
1: mov 0x14(%esp),%eax
5: mov 0x8(%esp),%ebx
9: mov 0xc(%esp),%ecx
d: mov 0x10(%esp),%edx
11: test $0xfffffeff,%eax
16: jne 38 <fchmodat+0x38>
18: test $0x1,%ah
1b: jne 48 <fchmodat+0x48>
1d: mov $0x132,%eax
22: call *%gs:0x10
29: cmp $0xfffff000,%eax
2e: ja 58 <fchmodat+0x58>
30: pop %ebx
31: ret
32: lea 0x0(%esi),%esi
38: pop %ebx
39: mov $0xffffffea,%eax
3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error
43: nop
44: lea 0x0(%esi,%eiz,1),%esi
48: pop %ebx
49: mov $0xffffffa1,%eax
4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error
53: nop
54: lea 0x0(%esi,%eiz,1),%esi
58: pop %ebx
59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error
instead of
<fchmodat>:
0: sub $0x8,%esp
3: mov 0x18(%esp),%eax
7: mov %ebx,(%esp)
a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx
f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
15: mov %edi,0x4(%esp)
19: test $0xfffffeff,%eax
1e: jne 70 <fchmodat+0x70>
20: test $0x1,%ah
23: jne 88 <fchmodat+0x88>
25: mov 0x14(%esp),%edx
29: mov 0x10(%esp),%ecx
2d: mov 0xc(%esp),%edi
31: xchg %ebx,%edi
33: mov $0x132,%eax
38: call *%gs:0x10
3f: xchg %edi,%ebx
41: cmp $0xfffff000,%eax
46: ja 58 <fchmodat+0x58>
48: mov (%esp),%ebx
4b: mov 0x4(%esp),%edi
4f: add $0x8,%esp
52: ret
53: nop
54: lea 0x0(%esi,%eiz,1),%esi
58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno
5e: neg %eax
60: mov %eax,%gs:(%edx)
63: mov $0xffffffff,%eax
68: jmp 48 <fchmodat+0x48>
6a: lea 0x0(%esi),%esi
70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno
76: movl $0x16,%gs:(%eax)
7d: mov $0xffffffff,%eax
82: jmp 48 <fchmodat+0x48>
84: lea 0x0(%esi,%eiz,1),%esi
88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno
8e: movl $0x5f,%gs:(%eax)
95: mov $0xffffffff,%eax
9a: jmp 48 <fchmodat+0x48>
* sysdeps/unix/sysv/linux/sysdep.h: New file.
* sysdeps/unix/sysv/linux/i386/sysdep.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/sysdep.h: Include
<sysdeps/unix/sysv/linux/sysdep.h>.
* sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/generic/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/hppa/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/microblaze/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == csu]
(sysdep-dl-routines): Add sysdep.
[$(subdir) == nptl] (libpthread-routines): Likewise.
[$(subdir) == rt] (librt-routines): Likewise.
* sysdeps/unix/sysv/linux/i386/clone.S (__clone): Don't check
PIC when branching to SYSCALL_ERROR_LABEL.
* sysdeps/unix/sysv/linux/i386/sysdep.S: Removed.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Include
<sysdeps/unix/sysv/linux/sysdep.h>.
(SYSCALL_ERROR_LABEL): Changed to __syscall_error.
(SYSCALL_ERROR_ERRNO): Removed.
(SYSCALL_ERROR_HANDLER): Changed to empty.
(SYSCALL_ERROR_HANDLER_TLS_STORE): Likewise.
(__syscall_error): New prototype.
[IS_IN (libc)] (INLINE_SYSCALL): New macro.
(INLINE_SYSCALL_ERROR_RETURN_VALUE): Likewise.
2015-10-13 18:58:53 +00:00
|
|
|
#include <sysdeps/unix/sysv/linux/sysdep.h>
|
2012-04-17 02:02:27 +00:00
|
|
|
#include <sysdeps/ia64/sysdep.h>
|
|
|
|
#include <dl-sysdep.h>
|
|
|
|
#include <tls.h>
|
2020-01-02 09:18:22 +00:00
|
|
|
#include <asm/break.h>
|
2012-04-17 02:02:27 +00:00
|
|
|
|
2012-05-08 03:17:48 +00:00
|
|
|
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
#include <errno.h>
|
|
|
|
#endif
|
|
|
|
|
2012-04-17 02:02:27 +00:00
|
|
|
/* As of GAS v2.4.90.0.7, including a ".align" directive inside a
|
|
|
|
function will cause bad unwind info to be emitted (GAS doesn't know
|
|
|
|
how to account for the padding introduced by the .align directive).
|
|
|
|
Turning on this macro will work around this bug by introducing the
|
|
|
|
necessary padding explicitly. */
|
|
|
|
#define GAS_ALIGN_BREAKS_UNWIND_INFO
|
|
|
|
|
|
|
|
/* For Linux we can use the system call table in the header file
|
|
|
|
/usr/include/asm/unistd.h
|
|
|
|
of the kernel. But these symbols do not follow the SYS_* syntax
|
|
|
|
so we have to redefine the `SYS_ify' macro here. */
|
|
|
|
#undef SYS_ify
|
2012-04-17 02:39:07 +00:00
|
|
|
#define SYS_ify(syscall_name) __NR_##syscall_name
|
2012-04-17 02:02:27 +00:00
|
|
|
|
|
|
|
#if defined USE_DL_SYSINFO \
|
2014-11-24 09:33:45 +00:00
|
|
|
&& (IS_IN (libc) \
|
2014-11-20 08:52:40 +00:00
|
|
|
|| IS_IN (libpthread) || IS_IN (librt))
|
2012-04-17 02:02:27 +00:00
|
|
|
# define IA64_USE_NEW_STUB
|
|
|
|
#else
|
|
|
|
# undef IA64_USE_NEW_STUB
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __ASSEMBLER__
|
|
|
|
|
|
|
|
#undef CALL_MCOUNT
|
|
|
|
#ifdef PROF
|
|
|
|
# define CALL_MCOUNT \
|
|
|
|
.data; \
|
|
|
|
1: data8 0; /* XXX fixme: use .xdata8 once labels work */ \
|
|
|
|
.previous; \
|
|
|
|
.prologue; \
|
|
|
|
.save ar.pfs, r40; \
|
|
|
|
alloc out0 = ar.pfs, 8, 0, 4, 0; \
|
|
|
|
mov out1 = gp; \
|
|
|
|
.save rp, out2; \
|
|
|
|
mov out2 = rp; \
|
|
|
|
.body; \
|
|
|
|
;; \
|
|
|
|
addl out3 = @ltoff(1b), gp; \
|
|
|
|
br.call.sptk.many rp = _mcount \
|
|
|
|
;;
|
|
|
|
#else
|
|
|
|
# define CALL_MCOUNT /* Do nothing. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Linux uses a negative return value to indicate syscall errors, unlike
|
|
|
|
most Unices, which use the condition codes' carry flag.
|
|
|
|
|
|
|
|
Since version 2.1 the return value of a system call might be negative
|
|
|
|
even if the call succeeded. E.g., the `lseek' system call might return
|
|
|
|
a large offset. Therefore we must not anymore test for < 0, but test
|
|
|
|
for a real error by making sure the value in %d0 is a real error
|
|
|
|
number. Linus said he will make sure the no syscall returns a value
|
|
|
|
in -1 .. -4095 as a valid result so we can savely test with -4095. */
|
|
|
|
|
|
|
|
/* We don't want the label for the error handler to be visible in the symbol
|
|
|
|
table when we define it here. */
|
2020-01-29 17:36:58 +00:00
|
|
|
#undef SYSCALL_ERROR_LABEL
|
2012-04-17 02:02:27 +00:00
|
|
|
#define SYSCALL_ERROR_LABEL __syscall_error
|
|
|
|
|
|
|
|
#undef PSEUDO
|
|
|
|
#define PSEUDO(name, syscall_name, args) \
|
|
|
|
ENTRY(name) \
|
|
|
|
DO_CALL (SYS_ify(syscall_name)); \
|
|
|
|
cmp.eq p6,p0=-1,r10; \
|
|
|
|
(p6) br.cond.spnt.few __syscall_error;
|
|
|
|
|
|
|
|
#define DO_CALL_VIA_BREAK(num) \
|
|
|
|
mov r15=num; \
|
2020-01-02 09:18:22 +00:00
|
|
|
break __IA64_BREAK_SYSCALL
|
2012-04-17 02:02:27 +00:00
|
|
|
|
|
|
|
#ifdef IA64_USE_NEW_STUB
|
|
|
|
# ifdef SHARED
|
|
|
|
# define DO_CALL(num) \
|
|
|
|
.prologue; \
|
|
|
|
adds r2 = SYSINFO_OFFSET, r13;; \
|
|
|
|
ld8 r2 = [r2]; \
|
|
|
|
.save ar.pfs, r11; \
|
|
|
|
mov r11 = ar.pfs;; \
|
|
|
|
.body; \
|
|
|
|
mov r15 = num; \
|
|
|
|
mov b7 = r2; \
|
|
|
|
br.call.sptk.many b6 = b7;; \
|
|
|
|
.restore sp; \
|
|
|
|
mov ar.pfs = r11; \
|
|
|
|
.prologue; \
|
|
|
|
.body
|
|
|
|
# else /* !SHARED */
|
|
|
|
# define DO_CALL(num) \
|
|
|
|
.prologue; \
|
|
|
|
mov r15 = num; \
|
|
|
|
movl r2 = _dl_sysinfo;; \
|
|
|
|
ld8 r2 = [r2]; \
|
|
|
|
.save ar.pfs, r11; \
|
|
|
|
mov r11 = ar.pfs;; \
|
|
|
|
.body; \
|
|
|
|
mov b7 = r2; \
|
|
|
|
br.call.sptk.many b6 = b7;; \
|
|
|
|
.restore sp; \
|
|
|
|
mov ar.pfs = r11; \
|
|
|
|
.prologue; \
|
|
|
|
.body
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# define DO_CALL(num) DO_CALL_VIA_BREAK(num)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef PSEUDO_END
|
|
|
|
#define PSEUDO_END(name) .endp C_SYMBOL_NAME(name);
|
|
|
|
|
|
|
|
#undef PSEUDO_NOERRNO
|
|
|
|
#define PSEUDO_NOERRNO(name, syscall_name, args) \
|
|
|
|
ENTRY(name) \
|
|
|
|
DO_CALL (SYS_ify(syscall_name));
|
|
|
|
|
|
|
|
#undef PSEUDO_END_NOERRNO
|
|
|
|
#define PSEUDO_END_NOERRNO(name) .endp C_SYMBOL_NAME(name);
|
|
|
|
|
|
|
|
#undef PSEUDO_ERRVAL
|
|
|
|
#define PSEUDO_ERRVAL(name, syscall_name, args) \
|
|
|
|
ENTRY(name) \
|
|
|
|
DO_CALL (SYS_ify(syscall_name)); \
|
|
|
|
cmp.eq p6,p0=-1,r10; \
|
|
|
|
(p6) mov r10=r8;
|
|
|
|
|
|
|
|
|
|
|
|
#undef PSEUDO_END_ERRVAL
|
|
|
|
#define PSEUDO_END_ERRVAL(name) .endp C_SYMBOL_NAME(name);
|
|
|
|
|
|
|
|
#undef END
|
|
|
|
#define END(name) \
|
|
|
|
.size C_SYMBOL_NAME(name), . - C_SYMBOL_NAME(name) ; \
|
|
|
|
.endp C_SYMBOL_NAME(name)
|
|
|
|
|
|
|
|
#define ret br.ret.sptk.few b0
|
|
|
|
#define ret_NOERRNO ret
|
|
|
|
#define ret_ERRVAL ret
|
|
|
|
|
|
|
|
#else /* not __ASSEMBLER__ */
|
|
|
|
|
2020-06-26 19:06:49 +00:00
|
|
|
#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
|
|
|
|
#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
|
|
|
|
|
2012-04-17 02:02:27 +00:00
|
|
|
#define BREAK_INSN_1(num) "break " #num ";;\n\t"
|
|
|
|
#define BREAK_INSN(num) BREAK_INSN_1(num)
|
|
|
|
|
|
|
|
/* On IA-64 we have stacked registers for passing arguments. The
|
|
|
|
"out" registers end up being the called function's "in"
|
|
|
|
registers.
|
|
|
|
|
|
|
|
Also, since we have plenty of registers we have two return values
|
|
|
|
from a syscall. r10 is set to -1 on error, whilst r8 contains the
|
|
|
|
(non-negative) errno on error or the return value on success.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef IA64_USE_NEW_STUB
|
|
|
|
|
2020-01-29 20:38:36 +00:00
|
|
|
# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
|
2020-02-03 00:03:28 +00:00
|
|
|
({ \
|
2012-04-17 02:02:27 +00:00
|
|
|
LOAD_ARGS_##nr (args) \
|
|
|
|
register long _r8 __asm ("r8"); \
|
|
|
|
register long _r10 __asm ("r10"); \
|
|
|
|
register long _r15 __asm ("r15") = name; \
|
|
|
|
register void *_b7 __asm ("b7") = ((tcbhead_t *)__thread_self)->__private;\
|
|
|
|
LOAD_REGS_##nr \
|
|
|
|
/* \
|
|
|
|
* Don't specify any unwind info here. We mark ar.pfs as \
|
|
|
|
* clobbered. This will force the compiler to save ar.pfs \
|
|
|
|
* somewhere and emit appropriate unwind info for that save. \
|
|
|
|
*/ \
|
|
|
|
__asm __volatile ("br.call.sptk.many b6=%0;;\n" \
|
|
|
|
: "=b"(_b7), "=r" (_r8), "=r" (_r10), "=r" (_r15) \
|
|
|
|
ASM_OUTARGS_##nr \
|
|
|
|
: "0" (_b7), "3" (_r15) ASM_ARGS_##nr \
|
|
|
|
: "memory", "ar.pfs" ASM_CLOBBERS_##nr); \
|
2020-02-03 00:03:28 +00:00
|
|
|
_r10 == -1 ? -_r8 : _r8; \
|
|
|
|
})
|
2012-04-17 02:02:27 +00:00
|
|
|
|
|
|
|
#else /* !IA64_USE_NEW_STUB */
|
|
|
|
|
2020-01-29 20:38:36 +00:00
|
|
|
# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
|
2020-02-03 00:03:28 +00:00
|
|
|
({ \
|
2012-04-17 02:02:27 +00:00
|
|
|
LOAD_ARGS_##nr (args) \
|
|
|
|
register long _r8 asm ("r8"); \
|
|
|
|
register long _r10 asm ("r10"); \
|
|
|
|
register long _r15 asm ("r15") = name; \
|
|
|
|
LOAD_REGS_##nr \
|
2020-01-02 09:18:22 +00:00
|
|
|
__asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \
|
2012-04-17 02:02:27 +00:00
|
|
|
: "=r" (_r8), "=r" (_r10), "=r" (_r15) \
|
|
|
|
ASM_OUTARGS_##nr \
|
|
|
|
: "2" (_r15) ASM_ARGS_##nr \
|
|
|
|
: "memory" ASM_CLOBBERS_##nr); \
|
2020-02-03 00:03:28 +00:00
|
|
|
_r10 == -1 ? -_r8 : _r8; \
|
|
|
|
})
|
2012-04-17 02:02:27 +00:00
|
|
|
|
|
|
|
#endif /* !IA64_USE_NEW_STUB */
|
|
|
|
|
2020-01-29 20:38:36 +00:00
|
|
|
#define INTERNAL_SYSCALL(name, nr, args...) \
|
|
|
|
INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
|
2012-04-17 02:02:27 +00:00
|
|
|
|
|
|
|
#define LOAD_ARGS_0()
|
|
|
|
#define LOAD_REGS_0
|
|
|
|
#define LOAD_ARGS_1(a1) \
|
|
|
|
long _arg1 = (long) (a1); \
|
|
|
|
LOAD_ARGS_0 ()
|
|
|
|
#define LOAD_REGS_1 \
|
|
|
|
register long _out0 asm ("out0") = _arg1; \
|
|
|
|
LOAD_REGS_0
|
|
|
|
#define LOAD_ARGS_2(a1, a2) \
|
|
|
|
long _arg2 = (long) (a2); \
|
|
|
|
LOAD_ARGS_1 (a1)
|
|
|
|
#define LOAD_REGS_2 \
|
|
|
|
register long _out1 asm ("out1") = _arg2; \
|
|
|
|
LOAD_REGS_1
|
|
|
|
#define LOAD_ARGS_3(a1, a2, a3) \
|
|
|
|
long _arg3 = (long) (a3); \
|
|
|
|
LOAD_ARGS_2 (a1, a2)
|
|
|
|
#define LOAD_REGS_3 \
|
|
|
|
register long _out2 asm ("out2") = _arg3; \
|
|
|
|
LOAD_REGS_2
|
|
|
|
#define LOAD_ARGS_4(a1, a2, a3, a4) \
|
|
|
|
long _arg4 = (long) (a4); \
|
|
|
|
LOAD_ARGS_3 (a1, a2, a3)
|
|
|
|
#define LOAD_REGS_4 \
|
|
|
|
register long _out3 asm ("out3") = _arg4; \
|
|
|
|
LOAD_REGS_3
|
|
|
|
#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
|
|
|
|
long _arg5 = (long) (a5); \
|
|
|
|
LOAD_ARGS_4 (a1, a2, a3, a4)
|
|
|
|
#define LOAD_REGS_5 \
|
|
|
|
register long _out4 asm ("out4") = _arg5; \
|
|
|
|
LOAD_REGS_4
|
|
|
|
#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
|
|
|
|
long _arg6 = (long) (a6); \
|
|
|
|
LOAD_ARGS_5 (a1, a2, a3, a4, a5)
|
|
|
|
#define LOAD_REGS_6 \
|
|
|
|
register long _out5 asm ("out5") = _arg6; \
|
|
|
|
LOAD_REGS_5
|
|
|
|
|
|
|
|
#define ASM_OUTARGS_0
|
|
|
|
#define ASM_OUTARGS_1 ASM_OUTARGS_0, "=r" (_out0)
|
|
|
|
#define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1)
|
|
|
|
#define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2)
|
|
|
|
#define ASM_OUTARGS_4 ASM_OUTARGS_3, "=r" (_out3)
|
|
|
|
#define ASM_OUTARGS_5 ASM_OUTARGS_4, "=r" (_out4)
|
|
|
|
#define ASM_OUTARGS_6 ASM_OUTARGS_5, "=r" (_out5)
|
|
|
|
|
|
|
|
#ifdef IA64_USE_NEW_STUB
|
|
|
|
#define ASM_ARGS_0
|
|
|
|
#define ASM_ARGS_1 ASM_ARGS_0, "4" (_out0)
|
|
|
|
#define ASM_ARGS_2 ASM_ARGS_1, "5" (_out1)
|
|
|
|
#define ASM_ARGS_3 ASM_ARGS_2, "6" (_out2)
|
|
|
|
#define ASM_ARGS_4 ASM_ARGS_3, "7" (_out3)
|
|
|
|
#define ASM_ARGS_5 ASM_ARGS_4, "8" (_out4)
|
|
|
|
#define ASM_ARGS_6 ASM_ARGS_5, "9" (_out5)
|
|
|
|
#else
|
|
|
|
#define ASM_ARGS_0
|
|
|
|
#define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0)
|
|
|
|
#define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1)
|
|
|
|
#define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2)
|
|
|
|
#define ASM_ARGS_4 ASM_ARGS_3, "6" (_out3)
|
|
|
|
#define ASM_ARGS_5 ASM_ARGS_4, "7" (_out4)
|
|
|
|
#define ASM_ARGS_6 ASM_ARGS_5, "8" (_out5)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0"
|
|
|
|
#define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1"
|
|
|
|
#define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2"
|
|
|
|
#define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3"
|
|
|
|
#define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4"
|
|
|
|
#define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5"
|
|
|
|
#define ASM_CLOBBERS_6_COMMON , "out6", "out7", \
|
|
|
|
/* Non-stacked integer registers, minus r8, r10, r15. */ \
|
2018-12-17 18:31:50 +00:00
|
|
|
"r2", "r3", "r9", "r11", "r13", "r14", "r16", "r17", "r18", \
|
2012-04-17 02:02:27 +00:00
|
|
|
"r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \
|
|
|
|
"r28", "r29", "r30", "r31", \
|
|
|
|
/* Predicate registers. */ \
|
|
|
|
"p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \
|
|
|
|
/* Non-rotating fp registers. */ \
|
|
|
|
"f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \
|
|
|
|
/* Branch registers. */ \
|
|
|
|
"b6"
|
|
|
|
|
|
|
|
#ifdef IA64_USE_NEW_STUB
|
|
|
|
# define ASM_CLOBBERS_6 ASM_CLOBBERS_6_COMMON
|
|
|
|
#else
|
|
|
|
# define ASM_CLOBBERS_6 ASM_CLOBBERS_6_COMMON , "b7"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* not __ASSEMBLER__ */
|
|
|
|
|
|
|
|
/* Pointer mangling support. */
|
2014-11-20 15:39:43 +00:00
|
|
|
#if IS_IN (rtld)
|
2012-04-17 02:02:27 +00:00
|
|
|
/* We cannot use the thread descriptor because in ld.so we use setjmp
|
|
|
|
earlier than the descriptor is initialized. */
|
|
|
|
#else
|
|
|
|
# ifdef __ASSEMBLER__
|
|
|
|
# define PTR_MANGLE(reg, tmpreg) \
|
|
|
|
add tmpreg=-16,r13 \
|
|
|
|
;; \
|
|
|
|
ld8 tmpreg=[tmpreg] \
|
|
|
|
;; \
|
|
|
|
xor reg=reg, tmpreg
|
|
|
|
# define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg)
|
|
|
|
# else
|
|
|
|
# define PTR_MANGLE(var) \
|
|
|
|
(var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ())
|
|
|
|
# define PTR_DEMANGLE(var) PTR_MANGLE (var)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* linux/ia64/sysdep.h */
|