From 7c3eed786021ede69394fe371c9e7c8bd603f5a8 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 4 Jun 2019 17:29:42 +0000 Subject: mips: Consolidate INTERNAL_VSYSCALL_CALL This patch consolidates the mips, mips64, and mips64-n32 INTERNAL_VSYSCALL_CALL on a single implementation. No semantic changes. I checked against a build for mips-linux-gnu, mips64-linux-gnu, and mips64-n32-linux-gnu. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (INTERNAL_VSYSCALL_CALL): Remove. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h (INTERNAL_VSYSCALL_CALL): New macro. --- sysdeps/unix/sysv/linux/mips/sysdep.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sysdeps/unix/sysv/linux/mips/sysdep.h') diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h index 5d05c90780..b2045fcc55 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -22,3 +22,19 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_gettimeofday" #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_clock_gettime" + +#ifndef __ASSEMBLER__ + +/* Standard MIPS syscalls have an error flag, and return a positive errno + when the error flag is set. Emulate this behaviour for vsyscalls so that + the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ +#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ + ({ \ + long _ret = funcptr (args); \ + err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ + if (err) \ + _ret = -_ret; \ + _ret; \ + }) + +#endif /* __ASSEMBLER__ */ -- cgit 1.4.1