aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/ia64
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-02-02 21:03:28 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-02-14 21:09:12 -0300
commit157252e9edc80374faa2bccc743b3d2933b1e062 (patch)
tree96727dbf42f46040299299208332e2f4859ea04f /sysdeps/unix/sysv/linux/ia64
parent975ace4eca4990bc1948d3a7a890de7f60e7e540 (diff)
downloadglibc-157252e9edc80374faa2bccc743b3d2933b1e062.tar
glibc-157252e9edc80374faa2bccc743b3d2933b1e062.tar.gz
glibc-157252e9edc80374faa2bccc743b3d2933b1e062.tar.bz2
glibc-157252e9edc80374faa2bccc743b3d2933b1e062.zip
ia64: Use Linux kABI for syscall return
It changes the ia64 INTERNAL_SYSCALL_NCS macro to return a negative value instead of the 'r10' register value on the 'err' macro argument. The macro INTERNAL_SYSCALL_DECL is no longer required, and the INTERNAL_SYSCALL_ERROR_P macro follows the other Linux kABIs. Checked on ia64-linux-gnu.
Diffstat (limited to 'sysdeps/unix/sysv/linux/ia64')
-rw-r--r--sysdeps/unix/sysv/linux/ia64/sysdep.h58
1 files changed, 24 insertions, 34 deletions
diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index 59442c50e9..dc122a8a70 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -191,13 +191,13 @@
#ifdef IA64_USE_NEW_STUB
-# define DO_INLINE_SYSCALL_NCS(name, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, err, 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 \
@@ -209,60 +209,50 @@
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, err, 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 (__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 __attribute__ ((unused))
-
-#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
- ({ \
- DO_INLINE_SYSCALL_NCS (name, nr, args) \
- err = _r10; \
- _retval; })
+# undef INLINE_SYSCALL
+# define INLINE_SYSCALL(name, nr, args...) \
+ ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
+ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
+ { \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
+ _sys_result = (unsigned long) -1; \
+ } \
+ (long) _sys_result; })
+
+# undef INTERNAL_SYSCALL_DECL
+# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
+
#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) \
- ({ (void) (val); \
- (err == -1); \
- })
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((unsigned long int) (val) > -4096UL)
#undef INTERNAL_SYSCALL_ERRNO
-#define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define LOAD_ARGS_0()
#define LOAD_REGS_0