diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.com> | 2015-04-17 10:58:31 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-05-26 10:10:36 -0300 |
commit | f534255e4d276ee7b20b45637d16a00b122e5df3 (patch) | |
tree | abbedc3d05bdfb526d0171fccd87fb84ecb1acd9 /sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | |
parent | 829a679fac1fe173e81cb2c08204d2da86cf3f3a (diff) | |
download | glibc-f534255e4d276ee7b20b45637d16a00b122e5df3.tar.gz glibc-f534255e4d276ee7b20b45637d16a00b122e5df3.tar.xz glibc-f534255e4d276ee7b20b45637d16a00b122e5df3.zip |
Consolidate vDSO macros and usage
This patch consolidate the Linux vDSO define and usage across all ports that uses it. The common vDSO definitions and calling through {INLINE/INTERNAL}_VSYSCALL macros are moved to a common header sysdep-vdso.h and vDSO name declaration and prototype is defined using a common macro. Also PTR_{MANGLE,DEMANGLE} is added to ports that does not use them for vDSO calls (aarch64, powerpc, s390, and tile) and thus it will reflect in code changes. For ports that already implement pointer mangling/demangling in vDSO system (i386, x32, x86_64) this patch is mainly a code refactor. Checked on x32, x86_64, x32, ppc64le, and aarch64.
Diffstat (limited to 'sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h')
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 72 |
1 files changed, 9 insertions, 63 deletions
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 324e19ba9a..a727f38ee5 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -61,74 +61,17 @@ #endif /* __ASSEMBLER__ */ -/* This version is for kernels that implement system calls that - behave like function calls as far as register saving. - It falls back to the syscall in the case that the vDSO doesn't - exist or fails for ENOSYS */ -#ifdef SHARED -# define INLINE_VSYSCALL(name, nr, args...) \ - ({ \ - __label__ out; \ - __label__ iserr; \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret; \ - \ - if (__vdso_##name != NULL) \ - { \ - sc_ret = \ - INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\ - if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - goto out; \ - if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \ - goto iserr; \ - } \ - \ - sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - iserr: \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - out: \ - sc_ret; \ - }) -#else -# define INLINE_VSYSCALL(name, nr, args...) \ - INLINE_SYSCALL (name, nr, ##args) -#endif - -#ifdef SHARED -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ - ({ \ - __label__ out; \ - long int v_ret; \ - \ - if (__vdso_##name != NULL) \ - { \ - v_ret = \ - INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \ - if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \ - || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \ - goto out; \ - } \ - v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \ - out: \ - v_ret; \ - }) -#else -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL (name, err, nr, ##args) -#endif - /* This version is for internal uses when there is no desire to set errno */ #define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \ ({ \ type sc_ret = ENOSYS; \ \ - if (__vdso_##name != NULL) \ - sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \ + __typeof (__vdso_##name) vdsop = __vdso_##name; \ + PTR_DEMANGLE (vdsop); \ + if (vdsop != NULL) \ + sc_ret = \ + INTERNAL_VSYSCALL_CALL_TYPE (vdsop, err, type, nr, ##args); \ else \ err = 1 << 28; \ sc_ret; \ @@ -144,7 +87,7 @@ gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) the negation of the return value in the kernel gets reverted. */ -#define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \ +#define INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, type, nr, args...) \ ({ \ register void *r0 __asm__ ("r0"); \ register long int r3 __asm__ ("r3"); \ @@ -168,6 +111,9 @@ rval; \ }) +#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ + INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) + #undef INLINE_SYSCALL /* This version is for kernels that implement system calls that |