diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h')
-rw-r--r-- | sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 2ad9c6224f..07285377b0 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -115,6 +115,17 @@ #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ + unsigned int err = INTERNAL_SYSCALL (name, nr, args); \ + if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (err), 0)) \ + { \ + __set_errno (INTERNAL_SYSCALL_ERRNO (err)); \ + err = -1; \ + } \ + (int) err; }) + +#undef INTERNAL_SYSCALL +#define INTERNAL_SYSCALL(name, nr, args...) \ + ({ \ DECLARGS_##nr(args) \ int err; \ asm volatile ( \ @@ -124,13 +135,14 @@ : "=d" (err) \ : "I" (__NR_##name) ASMFMT_##nr \ : "memory", "cc", "2", "3", "4", "5", "6"); \ - if (err >= 0xfffff001) \ - { \ - __set_errno(-err); \ - err = -1; \ - } \ (int) err; }) +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) + #define DECLARGS_0() #define DECLARGS_1(arg1) \ unsigned long gpr2 = (unsigned long) (arg1); |