-/* Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1999-2021 Free Software Foundation, Inc.
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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
#ifndef _LINUX_IA64_SYSDEP_H
#define _LINUX_IA64_SYSDEP_H 1
#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/unix/sysv/linux/sysdep.h>
#include <sysdeps/ia64/sysdep.h>
#include <dl-sysdep.h>
#include <tls.h>
+#include <asm/break.h>
+
+/* In order to get __set_errno() definition in INLINE_SYSCALL. */
+#ifndef __ASSEMBLER__
+#include <errno.h>
+#endif
/* 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
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
-#ifdef __STDC__
-# define SYS_ify(syscall_name) __NR_##syscall_name
-#else
-# define SYS_ify(syscall_name) __NR_/**/syscall_name
-#endif
-
-/* This is a kludge to make syscalls.list find these under the names
- pread and pwrite, since some kernel headers define those names
- and some define the *64 names for the same system calls. */
-#if !defined __NR_pread && defined __NR_pread64
-# define __NR_pread __NR_pread64
-#endif
-#if !defined __NR_pwrite && defined __NR_pwrite64
-# define __NR_pwrite __NR_pwrite64
-#endif
-
-/* This is to help the old kernel headers where __NR_semtimedop is not
- available. */
-#ifndef __NR_semtimedop
-# define __NR_semtimedop 1247
-#endif
+#define SYS_ify(syscall_name) __NR_##syscall_name
#if defined USE_DL_SYSINFO \
- && (!defined NOT_IN_libc \
- || defined IS_IN_libpthread || defined IS_IN_librt)
+ && (IS_IN (libc) \
+ || IS_IN (libpthread) || IS_IN (librt))
# define IA64_USE_NEW_STUB
#else
# undef IA64_USE_NEW_STUB
/* We don't want the label for the error handler to be visible in the symbol
table when we define it here. */
+#undef SYSCALL_ERROR_LABEL
#define SYSCALL_ERROR_LABEL __syscall_error
#undef PSEUDO
#define DO_CALL_VIA_BREAK(num) \
mov r15=num; \
- break __BREAK_SYSCALL
+ break __IA64_BREAK_SYSCALL
#ifdef IA64_USE_NEW_STUB
# ifdef SHARED
#else /* not __ASSEMBLER__ */
+#undef HAVE_INTERNAL_BRK_ADDR_SYMBOL
+#define HAVE_INTERNAL_BRK_ADDR_SYMBOL 1
+
#define BREAK_INSN_1(num) "break " #num ";;\n\t"
#define BREAK_INSN(num) BREAK_INSN_1(num)
#ifdef IA64_USE_NEW_STUB
-# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+({ \
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;\
- long _retval; \
LOAD_REGS_##nr \
/* \
* Don't specify any unwind info here. We mark ar.pfs as \
ASM_OUTARGS_##nr \
: "0" (_b7), "3" (_r15) ASM_ARGS_##nr \
: "memory", "ar.pfs" ASM_CLOBBERS_##nr); \
- _retval = _r8;
+ _r10 == -1 ? -_r8 : _r8; \
+})
#else /* !IA64_USE_NEW_STUB */
-# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+({ \
LOAD_ARGS_##nr (args) \
register long _r8 asm ("r8"); \
register long _r10 asm ("r10"); \
register long _r15 asm ("r15") = name; \
- long _retval; \
LOAD_REGS_##nr \
- __asm __volatile (BREAK_INSN (__BREAK_SYSCALL) \
+ __asm __volatile (BREAK_INSN (__IA64_BREAK_SYSCALL) \
: "=r" (_r8), "=r" (_r10), "=r" (_r15) \
ASM_OUTARGS_##nr \
: "2" (_r15) ASM_ARGS_##nr \
: "memory" ASM_CLOBBERS_##nr); \
- _retval = _r8;
+ _r10 == -1 ? -_r8 : _r8; \
+})
#endif /* !IA64_USE_NEW_STUB */
-#define DO_INLINE_SYSCALL(name, nr, args...) \
- DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args)
-
-#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args) \
- if (_r10 == -1) \
- { \
- __set_errno (_retval); \
- _retval = -1; \
- } \
- _retval; })
-
-#undef INTERNAL_SYSCALL_DECL
-#define INTERNAL_SYSCALL_DECL(err) long int err
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- DO_INLINE_SYSCALL_NCS (name, nr, args) \
- err = _r10; \
- _retval; })
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
-
-#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1)
-
-#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+#define INTERNAL_SYSCALL(name, nr, args...) \
+ INTERNAL_SYSCALL_NCS (__NR_##name, nr, ##args)
#define LOAD_ARGS_0()
#define LOAD_REGS_0
#define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5"
#define ASM_CLOBBERS_6_COMMON , "out6", "out7", \
/* Non-stacked integer registers, minus r8, r10, r15. */ \
- "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \
+ "r2", "r3", "r9", "r11", "r13", "r14", "r16", "r17", "r18", \
"r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \
"r28", "r29", "r30", "r31", \
/* Predicate registers. */ \
#endif /* not __ASSEMBLER__ */
/* Pointer mangling support. */
-#if defined NOT_IN_libc && defined IS_IN_rtld
+#if IS_IN (rtld)
/* We cannot use the thread descriptor because in ld.so we use setjmp
earlier than the descriptor is initialized. */
#else