2021-01-02 19:32:25 +00:00
|
|
|
/* Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
1997-06-23 21:54:51 +00:00
|
|
|
This file is part of the GNU C Library.
|
1996-02-13 11:38:58 +00:00
|
|
|
|
1997-06-23 21:54:51 +00:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:56:23 +00:00
|
|
|
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.
|
1996-02-13 11:38:58 +00:00
|
|
|
|
1997-06-23 21:54:51 +00:00
|
|
|
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
|
2001-07-06 04:56:23 +00:00
|
|
|
Lesser General Public License for more details.
|
1996-02-13 11:38:58 +00:00
|
|
|
|
2001-07-06 04:56:23 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-03-09 23:56:38 +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/>. */
|
1996-02-13 11:38:58 +00:00
|
|
|
|
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>
|
2010-03-12 18:50:55 +00:00
|
|
|
#include <tls.h>
|
1996-02-13 11:38:58 +00:00
|
|
|
|
2002-12-21 20:08:15 +00:00
|
|
|
/* Defines RTLD_PRIVATE_ERRNO. */
|
|
|
|
#include <dl-sysdep.h>
|
|
|
|
|
1996-03-14 11:19:46 +00:00
|
|
|
/* 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-01-29 15:23:28 +00:00
|
|
|
#define SYS_ify(syscall_name) __NR_##syscall_name
|
1996-03-14 11:19:46 +00:00
|
|
|
|
1998-05-29 10:20:59 +00:00
|
|
|
#ifdef __ASSEMBLER__
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
/* Linux uses a negative return value to indicate syscall errors, unlike
|
1996-10-17 01:51:33 +00:00
|
|
|
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
|
1996-11-07 01:34:35 +00:00
|
|
|
number. Linus said he will make sure the no syscall returns a value
|
1996-11-14 02:04:01 +00:00
|
|
|
in -1 .. -4095 as a valid result so we can savely test with -4095. */
|
1998-06-10 01:37:21 +00:00
|
|
|
|
|
|
|
/* 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
|
1998-06-10 01:37:21 +00:00
|
|
|
#ifdef PIC
|
|
|
|
#define SYSCALL_ERROR_LABEL .Lsyscall_error
|
|
|
|
#else
|
|
|
|
#define SYSCALL_ERROR_LABEL __syscall_error
|
|
|
|
#endif
|
|
|
|
|
1998-03-06 01:48:50 +00:00
|
|
|
#undef PSEUDO
|
1996-02-13 11:38:58 +00:00
|
|
|
#define PSEUDO(name, syscall_name, args) \
|
|
|
|
.text; \
|
|
|
|
ENTRY (name) \
|
1998-03-06 01:48:50 +00:00
|
|
|
DO_CALL (syscall_name, args); \
|
1996-11-14 02:04:01 +00:00
|
|
|
cmp.l &-4095, %d0; \
|
1998-06-10 01:37:21 +00:00
|
|
|
jcc SYSCALL_ERROR_LABEL
|
1996-10-17 01:51:33 +00:00
|
|
|
|
|
|
|
#undef PSEUDO_END
|
1996-10-22 23:29:26 +00:00
|
|
|
#define PSEUDO_END(name) \
|
|
|
|
SYSCALL_ERROR_HANDLER; \
|
|
|
|
END (name)
|
1996-02-13 11:38:58 +00:00
|
|
|
|
2003-03-23 19:42:23 +00:00
|
|
|
#undef PSEUDO_NOERRNO
|
|
|
|
#define PSEUDO_NOERRNO(name, syscall_name, args) \
|
|
|
|
.text; \
|
|
|
|
ENTRY (name) \
|
|
|
|
DO_CALL (syscall_name, args)
|
|
|
|
|
|
|
|
#undef PSEUDO_END_NOERRNO
|
|
|
|
#define PSEUDO_END_NOERRNO(name) \
|
|
|
|
END (name)
|
|
|
|
|
2003-11-30 16:44:48 +00:00
|
|
|
#define ret_NOERRNO rts
|
|
|
|
|
|
|
|
/* The function has to return the error code. */
|
|
|
|
#undef PSEUDO_ERRVAL
|
|
|
|
#define PSEUDO_ERRVAL(name, syscall_name, args) \
|
|
|
|
.text; \
|
|
|
|
ENTRY (name) \
|
|
|
|
DO_CALL (syscall_name, args); \
|
|
|
|
negl %d0
|
|
|
|
|
|
|
|
#undef PSEUDO_END_ERRVAL
|
|
|
|
#define PSEUDO_END_ERRVAL(name) \
|
|
|
|
END (name)
|
|
|
|
|
|
|
|
#define ret_ERRVAL rts
|
2003-03-25 23:15:40 +00:00
|
|
|
|
1996-02-13 11:38:58 +00:00
|
|
|
#ifdef PIC
|
2002-12-21 21:05:31 +00:00
|
|
|
# if RTLD_PRIVATE_ERRNO
|
2002-12-21 20:08:15 +00:00
|
|
|
# define SYSCALL_ERROR_HANDLER \
|
|
|
|
SYSCALL_ERROR_LABEL: \
|
2006-10-03 Richard Sandiford <richard@codesourcery.com>
* sysdeps/m68k/bits/mathdef.h: Moved from sysdeps/m68k to
sysdeps/m68k/m680x0.
* sysdeps/m68k/m68020/submul_1.S: Likewise.
* sysdeps/m68k/m68020/Makefile: Likewise.
* sysdeps/m68k/m68020/mul_1.S: Likewise.
* sysdeps/m68k/m68020/wordcopy.S: Likewise.
* sysdeps/m68k/m68020/addmul_1.S: Likewise.
* sysdeps/m68k/m68020/bits/string.h: Likewise.
* sysdeps/m68k/m68020/bits/atomic.h: Likewise.
* sysdeps/m68k/sub_n.S: Likewise.
* sysdeps/m68k/add_n.S: Likewise.
* sysdeps/m68k/s_isnanl.c: Likewise.
* sysdeps/m68k/fpu/s_log1p.c: Likewise.
* sysdeps/m68k/fpu/e_asinf.c: Likewise.
* sysdeps/m68k/fpu/s_cosl.c: Likewise.
* sysdeps/m68k/fpu/s_isinff.c: Likewise.
* sysdeps/m68k/fpu/k_rem_pio2.c: Likewise.
* sysdeps/m68k/fpu/s_ccos.c: Likewise.
* sysdeps/m68k/fpu/s_expm1.c: Likewise.
* sysdeps/m68k/fpu/slowexp.c: Likewise.
* sysdeps/m68k/fpu/k_rem_pio2l.c: Likewise.
* sysdeps/m68k/fpu/s_ccoshf.c: Likewise.
* sysdeps/m68k/fpu/s_ilogbl.c: Likewise.
* sysdeps/m68k/fpu/Makefile: Likewise.
* sysdeps/m68k/fpu/s_expm1f.c: Likewise.
* sysdeps/m68k/fpu/s_significandf.c: Likewise.
* sysdeps/m68k/fpu/e_pow.c: Likewise.
* sysdeps/m68k/fpu/s_csinh.c: Likewise.
* sysdeps/m68k/fpu/e_exp.c: Likewise.
* sysdeps/m68k/fpu/s_remquof.c: Likewise.
* sysdeps/m68k/fpu/s_ilogbf.c: Likewise.
* sysdeps/m68k/fpu/s_truncl.c: Likewise.
* sysdeps/m68k/fpu/s_frexpf.c: Likewise.
* sysdeps/m68k/fpu/s_cos.c: Likewise.
* sysdeps/m68k/fpu/fraiseexcpt.c: Likewise.
* sysdeps/m68k/fpu/branred.c: Likewise.
* sysdeps/m68k/fpu/s_frexpl.c: Likewise.
* sysdeps/m68k/fpu/s_atan.c: Likewise.
* sysdeps/m68k/fpu/e_rem_pio2f.c: Likewise.
* sysdeps/m68k/fpu/e_scalbl.c: Likewise.
* sysdeps/m68k/fpu/e_exp2.c: Likewise.
* sysdeps/m68k/fpu/s_cexpf.c: Likewise.
* sysdeps/m68k/fpu/mplog.c: Likewise.
* sysdeps/m68k/fpu/s_rintf.c: Likewise.
* sysdeps/m68k/fpu/s_tanh.c: Likewise.
* sysdeps/m68k/fpu/e_scalbf.c: Likewise.
* sysdeps/m68k/fpu/s_csinhl.c: Likewise.
* sysdeps/m68k/fpu/s_floorl.c: Likewise.
* sysdeps/m68k/fpu/k_tanf.c: Likewise.
* sysdeps/m68k/fpu/k_tanl.c: Likewise.
* sysdeps/m68k/fpu/e_fmodf.c: Likewise.
* sysdeps/m68k/fpu/e_atanhf.c: Likewise.
* sysdeps/m68k/fpu/s_isnanf.c: Likewise.
* sysdeps/m68k/fpu/s_fpclassifyl.c: Likewise.
* sysdeps/m68k/fpu/s_modf.c: Likewise.
* sysdeps/m68k/fpu/e_log2.c: Likewise.
* sysdeps/m68k/fpu/e_acosf.c: Likewise.
* sysdeps/m68k/fpu/s_log1pl.c: Likewise.
* sysdeps/m68k/fpu/e_log2f.c: Likewise.
* sysdeps/m68k/fpu/mpa.c: Likewise.
* sysdeps/m68k/fpu/t_exp.c: Likewise.
* sysdeps/m68k/fpu/e_acos.c: Likewise.
* sysdeps/m68k/fpu/s_expm1l.c: Likewise.
* sysdeps/m68k/fpu/s_ccoshl.c: Likewise.
* sysdeps/m68k/fpu/s_sinf.c: Likewise.
* sysdeps/m68k/fpu/k_tan.c: Likewise.
* sysdeps/m68k/fpu/k_cosl.c: Likewise.
* sysdeps/m68k/fpu/e_remainder.c: Likewise.
* sysdeps/m68k/fpu/s_trunc.c: Likewise.
* sysdeps/m68k/fpu/s_sincos.c: Likewise.
* sysdeps/m68k/fpu/s_scalbnl.c: Likewise.
* sysdeps/m68k/fpu/s_finitef.c: Likewise.
* sysdeps/m68k/fpu/s_tanhl.c: Likewise.
* sysdeps/m68k/fpu/s_lrintl.c: Likewise.
* sysdeps/m68k/fpu/slowpow.c: Likewise.
* sysdeps/m68k/fpu/mpexp.c: Likewise.
* sysdeps/m68k/fpu/s_isnanl.c: Likewise.
* sysdeps/m68k/fpu/e_expf.c: Likewise.
* sysdeps/m68k/fpu/s_significand.c: Likewise.
* sysdeps/m68k/fpu/e_sinhf.c: Likewise.
* sysdeps/m68k/fpu/s_tanl.c: Likewise.
* sysdeps/m68k/fpu/s_tanhf.c: Likewise.
* sysdeps/m68k/fpu/s_cexp.c: Likewise.
* sysdeps/m68k/fpu/e_sqrtf.c: Likewise.
* sysdeps/m68k/fpu/s_isinf.c: Likewise.
* sysdeps/m68k/fpu/s_nearbyint.c: Likewise.
* sysdeps/m68k/fpu/e_fmod.c: Likewise.
* sysdeps/m68k/fpu/sincos32.c: Likewise.
* sysdeps/m68k/fpu/e_sqrtl.c: Likewise.
* sysdeps/m68k/fpu/s_sincosl.c: Likewise.
* sysdeps/m68k/fpu/e_atan2f.c: Likewise.
* sysdeps/m68k/fpu/s_nearbyintf.c: Likewise.
* sysdeps/m68k/fpu/e_fmodl.c: Likewise.
* sysdeps/m68k/fpu/e_coshf.c: Likewise.
* sysdeps/m68k/fpu/s_csinf.c: Likewise.
* sysdeps/m68k/fpu/s_ccosl.c: Likewise.
* sysdeps/m68k/fpu/e_sqrt.c: Likewise.
* sysdeps/m68k/fpu/s_sin.c: Likewise.
* sysdeps/m68k/fpu/e_asin.c: Likewise.
* sysdeps/m68k/fpu/mptan.c: Likewise.
* sysdeps/m68k/fpu/e_exp10f.c: Likewise.
* sysdeps/m68k/fpu/e_scalb.c: Likewise.
* sysdeps/m68k/fpu/s_finitel.c: Likewise.
* sysdeps/m68k/fpu/e_log10.c: Likewise.
* sysdeps/m68k/fpu/k_sinl.c: Likewise.
* sysdeps/m68k/fpu/e_remainderl.c: Likewise.
* sysdeps/m68k/fpu/s_remquol.c: Likewise.
* sysdeps/m68k/fpu/s_scalblnf.c: Likewise.
* sysdeps/m68k/fpu/s_llrint.c: Likewise.
* sysdeps/m68k/fpu/e_rem_pio2.c: Likewise.
* sysdeps/m68k/fpu/e_asinl.c: Likewise.
* sysdeps/m68k/fpu/e_logl.c: Likewise.
* sysdeps/m68k/fpu/s_cosf.c: Likewise.
* sysdeps/m68k/fpu/s_rint.c: Likewise.
* sysdeps/m68k/fpu/s_ceill.c: Likewise.
* sysdeps/m68k/fpu/s_modfl.c: Likewise.
* sysdeps/m68k/fpu/s_csinl.c: Likewise.
* sysdeps/m68k/fpu/s_tan.c: Likewise.
* sysdeps/m68k/fpu/s_sincosf.c: Likewise.
* sysdeps/m68k/fpu/dosincos.c: Likewise.
* sysdeps/m68k/fpu/e_powl.c: Likewise.
* sysdeps/m68k/fpu/s_ilogb.c: Likewise.
* sysdeps/m68k/fpu/s_llrintl.c: Likewise.
* sysdeps/m68k/fpu/e_expl.c: Likewise.
* sysdeps/m68k/fpu/libm-test-ulps: Likewise.
* sysdeps/m68k/fpu/s_tanf.c: Likewise.
* sysdeps/m68k/fpu/mpsqrt.c: Likewise.
* sysdeps/m68k/fpu/s_sinl.c: Likewise.
* sysdeps/m68k/fpu/mathimpl.h: Likewise.
* sysdeps/m68k/fpu/e_acosl.c: Likewise.
* sysdeps/m68k/fpu/e_cosh.c: Likewise.
* sysdeps/m68k/fpu/s_cexpl.c: Likewise.
* sysdeps/m68k/fpu/s_fabsl.c: Likewise.
* sysdeps/m68k/fpu/halfulp.c: Likewise.
* sysdeps/m68k/fpu/s_modff.c: Likewise.
* sysdeps/m68k/fpu/s_isnan.c: Likewise.
* sysdeps/m68k/fpu/e_atan2.c: Likewise.
* sysdeps/m68k/fpu/s_fabs.c: Likewise.
* sysdeps/m68k/fpu/e_log10f.c: Likewise.
* sysdeps/m68k/fpu/k_cosf.c: Likewise.
* sysdeps/m68k/fpu/e_sinh.c: Likewise.
* sysdeps/m68k/fpu/s_truncf.c: Likewise.
* sysdeps/m68k/fpu/s_ceil.c: Likewise.
* sysdeps/m68k/fpu/s_log1pf.c: Likewise.
* sysdeps/m68k/fpu/e_logf.c: Likewise.
* sysdeps/m68k/fpu/mpatan.c: Likewise.
* sysdeps/m68k/fpu/s_csin.c: Likewise.
* sysdeps/m68k/fpu/e_exp2l.c: Likewise.
* sysdeps/m68k/fpu/e_sinhl.c: Likewise.
* sysdeps/m68k/fpu/e_atan2l.c: Likewise.
* sysdeps/m68k/fpu/s_scalbn.c: Likewise.
* sysdeps/m68k/fpu/s_floorf.c: Likewise.
* sysdeps/m68k/fpu/e_log2l.c: Likewise.
* sysdeps/m68k/fpu/s_atanl.c: Likewise.
* sysdeps/m68k/fpu/s_llrintf.c: Likewise.
* sysdeps/m68k/fpu/k_sinf.c: Likewise.
* sysdeps/m68k/fpu/s_csinhf.c: Likewise.
* sysdeps/m68k/fpu/s_frexp.c: Likewise.
* sysdeps/m68k/fpu/s_atanf.c: Likewise.
* sysdeps/m68k/fpu/s_floor.c: Likewise.
* sysdeps/m68k/fpu/e_exp10l.c: Likewise.
* sysdeps/m68k/fpu/doasin.c: Likewise.
* sysdeps/m68k/fpu/s_rintl.c: Likewise.
* sysdeps/m68k/fpu/e_atanhl.c: Likewise.
* sysdeps/m68k/fpu/e_remainderf.c: Likewise.
* sysdeps/m68k/fpu/s_scalbln.c: Likewise.
* sysdeps/m68k/fpu/e_rem_pio2l.c: Likewise.
* sysdeps/m68k/fpu/e_exp10.c: Likewise.
* sysdeps/m68k/fpu/s_lrintf.c: Likewise.
* sysdeps/m68k/fpu/k_cos.c: Likewise.
* sysdeps/m68k/fpu/s_lrint.c: Likewise.
* sysdeps/m68k/fpu/s_ccosf.c: Likewise.
* sysdeps/m68k/fpu/s_scalblnl.c: Likewise.
* sysdeps/m68k/fpu/switch/Makefile: Likewise.
* sysdeps/m68k/fpu/switch/switch.c: Likewise.
* sysdeps/m68k/fpu/switch/68881-sw.h: Likewise.
* sysdeps/m68k/fpu/switch/bits/mathinline.h: Likewise.
* sysdeps/m68k/fpu/e_log.c: Likewise.
* sysdeps/m68k/fpu/s_nextafterl.c: Likewise.
* sysdeps/m68k/fpu/s_nearbyintl.c: Likewise.
* sysdeps/m68k/fpu/mpatan2.c: Likewise.
* sysdeps/m68k/fpu/k_sin.c: Likewise.
* sysdeps/m68k/fpu/e_atanh.c: Likewise.
* sysdeps/m68k/fpu/s_remquo.c: Likewise.
* sysdeps/m68k/fpu/e_log10l.c: Likewise.
* sysdeps/m68k/fpu/s_ceilf.c: Likewise.
* sysdeps/m68k/fpu/s_fabsf.c: Likewise.
* sysdeps/m68k/fpu/s_significandl.c: Likewise.
* sysdeps/m68k/fpu/s_ccosh.c: Likewise.
* sysdeps/m68k/fpu/e_coshl.c: Likewise.
* sysdeps/m68k/fpu/s_scalbnf.c: Likewise.
* sysdeps/m68k/fpu/s_finite.c: Likewise.
* sysdeps/m68k/fpu/e_exp2f.c: Likewise.
* sysdeps/m68k/fpu/k_rem_pio2f.c: Likewise.
* sysdeps/m68k/fpu/s_isinfl.c: Likewise.
* sysdeps/m68k/fpu/bits/mathinline.h: Likewise.
* sysdeps/m68k/fpu/e_powf.c: Likewise.
* sysdeps/m68k/rshift.S: Likewise.
* sysdeps/m68k/lshift.S: Likewise.
* sysdeps/m68k/strtold_l.c: Likewise.
* sysdeps/m68k/printf_fphex.c: Likewise.
* sysdeps/m68k/s_isinfl.c: Likewise.
* sysdeps/m68k/bits/huge_vall.h: Likewise.
* sysdeps/m68k/asm-syntax.h (andw, andl, subqw, tstw, tstl): New.
* sysdeps/m68k/bits/byteswap.h (__bswap32): Don't define for
Coldfire targets.
* sysdeps/m68k/bits/setjmp.h (__jmp_buf): Add a 64-byte
__fpregs field for Coldfire FPUs.
* sysdeps/m68k/dl-machine.h: Include sysdep.h.
(elf_machine_load_address): Use PCREL_OP.
(_dl_start_user): Likewise.
* sysdeps/m68k/dl-trampoline.S (_dl_runtime_resolve): Avoid jmp (%dN)
on Coldfire; push the target address and use rts instead.
(_dl_runtime_profile): Likewise. Round up the frame size to longword
rather than word alignment. Avoid dbra on Coldfire. Avoid using
jsr (%d0) on Coldfire; push the return address and target address
and use rts instead. Use fmovem.l rather than fmovem.x on Coldfire.
Add missing initialization of lrv_a0 and restore a0 from it after
calling _dl_call_pltexit. Adjust the stack offsets of later data
accordingly, fixing a previously incorrect offset for the inregs
parameter.
* sysdeps/m68k/fpu/fegetenv.c (__fegetenv): Save the control
registers individually on Coldfire targets.
* sysdeps/m68k/fpu/feholdexcpt.c (feholdexcept): Likewise.
Add missing libm_hidden_def.
* sysdeps/m68k/fpu/fesetenv.c (__fesetenv): Save and restore the
control registers individually on Coldfire targets.
* sysdeps/m68k/fpu/fesetround.c (fesetround): Add missing
libm_hidden_def.
* sysdeps/m68k/fpu_control.h: Add the Coldfire bit assignments to
the main comment.
(_FPU_DOUBLE): Define to 0 for Coldfire.
(_FPU_EXTENDED): Don't define for Coldfire.
(_FPU_RESERVED): Include bit 15 for Coldfire.
* sysdeps/m68k/Implies: Remove ieee754/ldbl-96.
* sysdeps/m68k/m680x0/Implies: Add it to this new file instead.
* sysdeps/m68k/ldsodefs.h: New file.
* sysdeps/m68k/__longjmp.c (__longjmp): Restore the floating-point
registers when using a Coldfire FPU.
* sysdeps/m68k/Makefile (long-double-fcts): Delete.
* sysdeps/m68k/m680x0/Makefile: Add it to this new file instead.
* sysdeps/m68k/memchr.S (__memchr): Add Coldfire code. Avoid
unnecessary moves.
* sysdeps/m68k/preconfigure (m680?0): Add "m680x0" to $machine.
(m68k): Use the compiler to decide whether $machine should be
set to m68k/coldfire or m68k/m680x0/m68020.
* sysdeps/m68k/rawmemchr.S (__rawmemchr): Add Coldfire code. Avoid
unnecessary moves.
* sysdeps/m68k/setjmp.c (__sigsetjmp): Save the floating-point
registers when using a Coldfire FPU. Use libc_hidden_def rather
than hidden_def.
* sysdeps/m68k/strchrnul.S (__strchrnul): Add Coldfire code. Avoid
unnecessary moves.
* sysdeps/m68k/strchr.S (strchr): Likewise.
* sysdeps/m68k/sysdep.h (PCREL_OP): Define.
* sysdeps/m68k/tst-audit.h: New file.
* sysdeps/m68k/wcpcpy.c: Likewise.
* sysdeps/m68k/wcpcpy_chk.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/configure.in: New file.
* sysdeps/unix/sysv/linux/m68k/configure: Likewise.
* sysdeps/unix/sysv/linux/m68k/clone.S (__clone): Add Coldfire code.
* sysdeps/unix/sysv/linux/m68k/register-dump.h (real_catch_segfault):
Do not define on Coldfire.
(catch_segfault): Likewise.
(register_dump): Use the Coldfire-specific sigcontext fields to
display call-saved data and address registers (rather than the
data stored in sc_fpstate by real_catch_segfault). Display 8-byte
floating-point registers on Coldfire.
* sysdeps/unix/sysv/linux/m68k/socket.S (__socket): Pass a temporary
register to SINGLE_THREAD_P.
* sysdeps/unix/sysv/linux/m68k/sys/reg.h (PT_FP0): Redefine for
Coldfire.
(PT_FP1, PT_FP2, PT_FP3, PT_FP4, PT_FP5, PT_FP6, PT_FP7): Likewise.
* sysdeps/unix/sysv/linux/m68k/sys/ucontext.h (fpregset): Sync field
order with linux. Make f_fpregs an 8*2 array on Coldfire.
(ucontext): Sync field order with linux.
* sysdeps/unix/sysv/linux/m68k/sysdep.h: Guard against multiple
inclusion.
(SYSCALL_ERROR_HANDLER): Use PCREL_OP.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (oldgetrlimit): Delete.
(oldsetrlimit): Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list: New file.
List oldgetrlimit and oldsetrlimit here instead.
* sysdeps/unix/sysv/linux/m68k/bits/sigcontext.h: New file.
* sysdeps/unix/sysv/linux/m68k/bits/siginfo.h: Likewise.
* sysdeps/m68k/coldfire/bits/atomic.h: Likewise.
* sysdeps/m68k/coldfire/fpu/e_sqrt.c: Likewise.
* sysdeps/m68k/coldfire/fpu/e_sqrtf.c: Likewise.
* sysdeps/m68k/coldfire/fpu/fraiseexcpt.c: Likewise.
* sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise.
* sysdeps/m68k/coldfire/fpu/s_fabs.c: Likewise.
* sysdeps/m68k/coldfire/fpu/s_fabsf.c: Likewise.
* sysdeps/m68k/coldfire/fpu/s_lrint.c: Likewise.
* sysdeps/m68k/coldfire/fpu/s_lrintf.c: Likewise.
* sysdeps/m68k/coldfire/fpu/s_rint.c: Likewise.
* sysdeps/m68k/coldfire/fpu/s_rintf.c: Likewise.
* sysdeps/m68k/coldfire/shlib-versions: Likewise.
2006-10-03 14:44:27 +00:00
|
|
|
PCREL_OP (lea, rtld_errno, %a0, %a0); \
|
2002-12-21 20:08:15 +00:00
|
|
|
neg.l %d0; \
|
|
|
|
move.l %d0, (%a0); \
|
|
|
|
move.l &-1, %d0; \
|
|
|
|
/* Copy return value to %a0 for syscalls that are declared to return \
|
|
|
|
a pointer (e.g., mmap). */ \
|
|
|
|
move.l %d0, %a0; \
|
|
|
|
rts;
|
2011-09-11 14:47:45 +00:00
|
|
|
# elif defined _LIBC_REENTRANT
|
2014-11-24 09:33:45 +00:00
|
|
|
# if IS_IN (libc)
|
2010-03-13 00:00:03 +00:00
|
|
|
# define SYSCALL_ERROR_ERRNO __libc_errno
|
|
|
|
# else
|
|
|
|
# define SYSCALL_ERROR_ERRNO errno
|
|
|
|
# endif
|
|
|
|
# define SYSCALL_ERROR_HANDLER \
|
|
|
|
SYSCALL_ERROR_LABEL: \
|
|
|
|
neg.l %d0; \
|
|
|
|
move.l %d0, -(%sp); \
|
2012-01-05 13:52:48 +00:00
|
|
|
cfi_adjust_cfa_offset (4); \
|
2010-03-13 00:00:03 +00:00
|
|
|
jbsr __m68k_read_tp@PLTPC; \
|
2010-08-02 16:48:56 +00:00
|
|
|
SYSCALL_ERROR_LOAD_GOT (%a1); \
|
2010-03-13 00:00:03 +00:00
|
|
|
add.l (SYSCALL_ERROR_ERRNO@TLSIE, %a1), %a0; \
|
|
|
|
move.l (%sp)+, (%a0); \
|
2012-01-05 13:52:48 +00:00
|
|
|
cfi_adjust_cfa_offset (-4); \
|
2010-03-13 00:00:03 +00:00
|
|
|
move.l &-1, %d0; \
|
|
|
|
/* Copy return value to %a0 for syscalls that are declared to return \
|
|
|
|
a pointer (e.g., mmap). */ \
|
|
|
|
move.l %d0, %a0; \
|
|
|
|
rts;
|
|
|
|
# else /* !_LIBC_REENTRANT */
|
|
|
|
/* Store (- %d0) into errno through the GOT. */
|
|
|
|
# define SYSCALL_ERROR_HANDLER \
|
1998-06-10 01:37:21 +00:00
|
|
|
SYSCALL_ERROR_LABEL: \
|
1996-09-12 02:50:36 +00:00
|
|
|
move.l (errno@GOTPC, %pc), %a0; \
|
|
|
|
neg.l %d0; \
|
|
|
|
move.l %d0, (%a0); \
|
1996-10-17 01:51:33 +00:00
|
|
|
move.l &-1, %d0; \
|
1996-09-12 02:50:36 +00:00
|
|
|
/* Copy return value to %a0 for syscalls that are declared to return \
|
|
|
|
a pointer (e.g., mmap). */ \
|
|
|
|
move.l %d0, %a0; \
|
|
|
|
rts;
|
2010-03-13 00:00:03 +00:00
|
|
|
# endif /* _LIBC_REENTRANT */
|
1996-09-12 02:50:36 +00:00
|
|
|
#else
|
2002-12-21 20:08:15 +00:00
|
|
|
# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
|
1996-09-12 02:50:36 +00:00
|
|
|
#endif /* PIC */
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
/* Linux takes system call arguments in registers:
|
|
|
|
|
|
|
|
syscall number %d0 call-clobbered
|
|
|
|
arg 1 %d1 call-clobbered
|
|
|
|
arg 2 %d2 call-saved
|
|
|
|
arg 3 %d3 call-saved
|
|
|
|
arg 4 %d4 call-saved
|
|
|
|
arg 5 %d5 call-saved
|
2010-03-12 18:50:55 +00:00
|
|
|
arg 6 %a0 call-clobbered
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
The stack layout upon entering the function is:
|
|
|
|
|
2010-03-12 18:50:55 +00:00
|
|
|
24(%sp) Arg# 6
|
1996-02-13 11:38:58 +00:00
|
|
|
20(%sp) Arg# 5
|
|
|
|
16(%sp) Arg# 4
|
|
|
|
12(%sp) Arg# 3
|
|
|
|
8(%sp) Arg# 2
|
|
|
|
4(%sp) Arg# 1
|
|
|
|
(%sp) Return address
|
|
|
|
|
|
|
|
(Of course a function with say 3 arguments does not have entries for
|
|
|
|
arguments 4 and 5.)
|
|
|
|
|
|
|
|
Separate move's are faster than movem, but need more space. Since
|
|
|
|
speed is more important, we don't use movem. Since %a0 and %a1 are
|
|
|
|
scratch registers, we can use them for saving as well. */
|
|
|
|
|
1998-03-06 01:48:50 +00:00
|
|
|
#define DO_CALL(syscall_name, args) \
|
|
|
|
move.l &SYS_ify(syscall_name), %d0; \
|
1996-02-13 11:38:58 +00:00
|
|
|
DOARGS_##args \
|
1996-10-17 01:51:33 +00:00
|
|
|
trap &0; \
|
1996-02-13 11:38:58 +00:00
|
|
|
UNDOARGS_##args
|
|
|
|
|
|
|
|
#define DOARGS_0 /* No arguments to frob. */
|
|
|
|
#define UNDOARGS_0 /* No arguments to unfrob. */
|
|
|
|
#define _DOARGS_0(n) /* No arguments to frob. */
|
|
|
|
|
|
|
|
#define DOARGS_1 _DOARGS_1 (4)
|
|
|
|
#define _DOARGS_1(n) move.l n(%sp), %d1; _DOARGS_0 (n)
|
|
|
|
#define UNDOARGS_1 UNDOARGS_0
|
|
|
|
|
|
|
|
#define DOARGS_2 _DOARGS_2 (8)
|
2012-01-05 13:52:48 +00:00
|
|
|
#define _DOARGS_2(n) move.l %d2, %a0; cfi_register (%d2, %a0); \
|
|
|
|
move.l n(%sp), %d2; _DOARGS_1 (n-4)
|
|
|
|
#define UNDOARGS_2 UNDOARGS_1; move.l %a0, %d2; cfi_restore (%d2)
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
#define DOARGS_3 _DOARGS_3 (12)
|
2012-01-05 13:52:48 +00:00
|
|
|
#define _DOARGS_3(n) move.l %d3, %a1; cfi_register (%d3, %a1); \
|
|
|
|
move.l n(%sp), %d3; _DOARGS_2 (n-4)
|
|
|
|
#define UNDOARGS_3 UNDOARGS_2; move.l %a1, %d3; cfi_restore (%d3)
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
#define DOARGS_4 _DOARGS_4 (16)
|
2012-01-05 13:52:48 +00:00
|
|
|
#define _DOARGS_4(n) move.l %d4, -(%sp); \
|
|
|
|
cfi_adjust_cfa_offset (4); cfi_rel_offset (%d4, 0); \
|
|
|
|
move.l n+4(%sp), %d4; _DOARGS_3 (n)
|
|
|
|
#define UNDOARGS_4 UNDOARGS_3; move.l (%sp)+, %d4; \
|
|
|
|
cfi_adjust_cfa_offset (-4); cfi_restore (%d4)
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
#define DOARGS_5 _DOARGS_5 (20)
|
2012-01-05 13:52:48 +00:00
|
|
|
#define _DOARGS_5(n) move.l %d5, -(%sp); \
|
|
|
|
cfi_adjust_cfa_offset (4); cfi_rel_offset (%d5, 0); \
|
|
|
|
move.l n+4(%sp), %d5; _DOARGS_4 (n)
|
|
|
|
#define UNDOARGS_5 UNDOARGS_4; move.l (%sp)+, %d5; \
|
|
|
|
cfi_adjust_cfa_offset (-4); cfi_restore (%d5)
|
1996-02-13 11:38:58 +00:00
|
|
|
|
2006-11-27 23:03:17 +00:00
|
|
|
#define DOARGS_6 _DOARGS_6 (24)
|
2012-01-05 13:52:48 +00:00
|
|
|
#define _DOARGS_6(n) _DOARGS_5 (n-4); move.l %a0, -(%sp); \
|
|
|
|
cfi_adjust_cfa_offset (4); \
|
|
|
|
move.l n+12(%sp), %a0;
|
|
|
|
#define UNDOARGS_6 move.l (%sp)+, %a0; cfi_adjust_cfa_offset (-4); \
|
|
|
|
UNDOARGS_5
|
2006-11-27 23:03:17 +00:00
|
|
|
|
1996-02-13 11:38:58 +00:00
|
|
|
|
|
|
|
#define ret rts
|
|
|
|
#if 0 /* Not used by Linux */
|
|
|
|
#define r0 %d0
|
|
|
|
#define r1 %d1
|
|
|
|
#define MOVE(x,y) movel x , y
|
|
|
|
#endif
|
|
|
|
|
1998-10-26 01:47:41 +00:00
|
|
|
#else /* not __ASSEMBLER__ */
|
|
|
|
|
2002-12-21 19:36:50 +00:00
|
|
|
/* Define a macro which expands inline into the wrapper code for a system
|
|
|
|
call. This use is for internal calls that do not need to handle errors
|
|
|
|
normally. It will never touch errno. This returns just what the kernel
|
|
|
|
gave back. */
|
|
|
|
#undef INTERNAL_SYSCALL
|
2020-01-29 20:38:36 +00:00
|
|
|
#define INTERNAL_SYSCALL_NCS(name, nr, args...) \
|
1998-10-26 01:47:41 +00:00
|
|
|
({ unsigned int _sys_result; \
|
|
|
|
{ \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
/* Load argument values in temporary variables
|
|
|
|
to perform side effects like function calls
|
|
|
|
before the call used registers are set. */ \
|
1998-10-26 01:47:41 +00:00
|
|
|
LOAD_ARGS_##nr (args) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_REGS_##nr \
|
2010-03-12 18:50:55 +00:00
|
|
|
register int _d0 asm ("%d0") = name; \
|
1998-10-26 01:47:41 +00:00
|
|
|
asm volatile ("trap #0" \
|
|
|
|
: "=d" (_d0) \
|
1998-11-16 02:41:56 +00:00
|
|
|
: "0" (_d0) ASM_ARGS_##nr \
|
2001-07-22 18:18:34 +00:00
|
|
|
: "memory"); \
|
1998-10-26 01:47:41 +00:00
|
|
|
_sys_result = _d0; \
|
|
|
|
} \
|
|
|
|
(int) _sys_result; })
|
2020-01-29 20:38:36 +00:00
|
|
|
#define INTERNAL_SYSCALL(name, nr, args...) \
|
|
|
|
INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
|
1998-10-26 01:47:41 +00:00
|
|
|
|
|
|
|
#define LOAD_ARGS_0()
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
#define LOAD_REGS_0
|
1998-10-26 01:47:41 +00:00
|
|
|
#define ASM_ARGS_0
|
|
|
|
#define LOAD_ARGS_1(a1) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_ARGS_0 () \
|
|
|
|
int __arg1 = (int) (a1);
|
|
|
|
#define LOAD_REGS_1 \
|
|
|
|
register int _d1 asm ("d1") = __arg1; \
|
|
|
|
LOAD_REGS_0
|
1998-10-26 01:47:41 +00:00
|
|
|
#define ASM_ARGS_1 ASM_ARGS_0, "d" (_d1)
|
|
|
|
#define LOAD_ARGS_2(a1, a2) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_ARGS_1 (a1) \
|
|
|
|
int __arg2 = (int) (a2);
|
|
|
|
#define LOAD_REGS_2 \
|
|
|
|
register int _d2 asm ("d2") = __arg2; \
|
|
|
|
LOAD_REGS_1
|
1998-10-26 01:47:41 +00:00
|
|
|
#define ASM_ARGS_2 ASM_ARGS_1, "d" (_d2)
|
|
|
|
#define LOAD_ARGS_3(a1, a2, a3) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_ARGS_2 (a1, a2) \
|
|
|
|
int __arg3 = (int) (a3);
|
|
|
|
#define LOAD_REGS_3 \
|
|
|
|
register int _d3 asm ("d3") = __arg3; \
|
|
|
|
LOAD_REGS_2
|
1998-10-26 01:47:41 +00:00
|
|
|
#define ASM_ARGS_3 ASM_ARGS_2, "d" (_d3)
|
|
|
|
#define LOAD_ARGS_4(a1, a2, a3, a4) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_ARGS_3 (a1, a2, a3) \
|
|
|
|
int __arg4 = (int) (a4);
|
|
|
|
#define LOAD_REGS_4 \
|
|
|
|
register int _d4 asm ("d4") = __arg4; \
|
|
|
|
LOAD_REGS_3
|
1998-10-26 01:47:41 +00:00
|
|
|
#define ASM_ARGS_4 ASM_ARGS_3, "d" (_d4)
|
|
|
|
#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_ARGS_4 (a1, a2, a3, a4) \
|
|
|
|
int __arg5 = (int) (a5);
|
|
|
|
#define LOAD_REGS_5 \
|
|
|
|
register int _d5 asm ("d5") = __arg5; \
|
|
|
|
LOAD_REGS_4
|
1998-10-26 01:47:41 +00:00
|
|
|
#define ASM_ARGS_5 ASM_ARGS_4, "d" (_d5)
|
2002-11-24 19:41:42 +00:00
|
|
|
#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
|
(INTERNAL_SYSCALL): Add
LOAD_REGS_##nr.
(LOAD_ARGS_0, LOAD_ARGS_1, LOAD_ARGS_2, LOAD_ARGS_3, LOAD_ARGS_4)
(LOAD_ARGS_5, LOAD_ARGS_6): Load argument values into temporary
variables.
(LOAD_REGS_0, LOAD_REGS_1, LOAD_REGS_2, LOAD_REGS_3, LOAD_REGS_4)
(LOAD_REGS_5, LOAD_REGS_6): New macros to actually load the
syscall argument registers.
2004-04-08 23:30:26 +00:00
|
|
|
LOAD_ARGS_5 (a1, a2, a3, a4, a5) \
|
|
|
|
int __arg6 = (int) (a6);
|
|
|
|
#define LOAD_REGS_6 \
|
|
|
|
register int _a0 asm ("a0") = __arg6; \
|
|
|
|
LOAD_REGS_5
|
2002-11-24 19:41:42 +00:00
|
|
|
#define ASM_ARGS_6 ASM_ARGS_5, "a" (_a0)
|
1998-10-26 01:47:41 +00:00
|
|
|
|
2020-06-26 19:06:49 +00:00
|
|
|
#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
|
|
|
|
#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
|
|
|
|
|
1998-10-26 01:47:41 +00:00
|
|
|
#endif /* not __ASSEMBLER__ */
|
2010-03-12 18:50:55 +00:00
|
|
|
|
|
|
|
/* Pointer mangling is not yet supported for M68K. */
|
|
|
|
#define PTR_MANGLE(var) (void) (var)
|
|
|
|
#define PTR_DEMANGLE(var) (void) (var)
|
|
|
|
|
|
|
|
#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
|
|
|
|
/* M68K needs system-supplied DSO to access TLS helpers
|
|
|
|
even when statically linked. */
|
|
|
|
# define NEED_STATIC_SYSINFO_DSO 1
|
|
|
|
#endif
|