From patchwork Thu Aug 29 16:50:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34343 Received: (qmail 3106 invoked by alias); 29 Aug 2019 16:54:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3012 invoked by uid 89); 29 Aug 2019 16:54:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy= X-HELO: esa2.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1567097696; x=1598633696; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G4JCsAWDJrfuqda1v1Z1nmNzkUOaG4hbSBruSC/E05k=; b=CZjJf7iAwyLoRFOG7HfdpB7eJMc+7tOj2e2s/duomYnhdzWG71Su5j57 sl1/x/KQr11XaWohyGABHjfIjaY5zjD9/YemeycjNSL/WMmEHLw6q3kOd hz1qpjXzEtWxmp3wMERtJuQjPw6fG7wLQkHUMSNoE99FqQY2XsFMXFeHv kawp3eO+jK798p1bTBjt92+fD7Rh/g3SPMDX1QNKcEuvwwTV3u66uqixk gozMydrJ3CFULqsbna3frYhGlnFgVH6UHE6TF63X2/xQTe76phNAUyhpo KDmw6G53FyVvM53w5IPckyxtAe0fOIvjIEeVw6z2cdG8mPbxCjkhzKEnc g==; IronPort-SDR: VXfdkQfuOb9CP1amq6DvW9QRitpLYDx5V0dGwWlIRBkliLUqnFaSIG9LCyst4mOsPgQop2U7k4 X3let7GjvMIlwQmZDKsZxWH5nfqS+wmZt4MTkI98XByfzpmOB0AVz/E3TH7H0nds7TivrRNNJq sClAm8BdiNstascaOzoyBQl/HU9LOJ1IXrjliKA7gKVFcleJgQ6t9j3bYavL+xHJpFSkYSL4Jk TbTtLWCRIBxOSVJ5bzwwUuWVAAyAnqqUbYTRL3Uz6NY5nE4quyzY20ayYLM5SBRx9z4A4lZbmM 4tU= IronPort-SDR: TaFj7NwiHyW348C33mZS0SCrKVZ8Oa4sO/zxzSFbfss+WWPe4EpzVxbrkjW7JfvcrnPmfKDnb4 8cpxOVYm+fDPy8zXXrkM/nvqvDe394I0STaGpRyX0MF3WoK+FYS5HzfwK61MINxf0oISX0XLHY WswBVpudeCFcDOk9fp4oJgZTMEqQLzO42rQO7NCTaltBX85HB1reyaJEApCveOCd/CSPxfbvNw mXjrqSazstzaid5LdFogNF5CE8AaZ7G9f5Cz8X4aVTUSOp9iMrbdp8sglV9NtLeulDuCTwjWiR JLdo76fhCIqycLb1IocKLqrJ IronPort-SDR: mo9UdvHwOvnR2zXBrLa+tuYtQsg0l6tRmM7brRPaV6tAj6LZ2cPHIJt8pi5MWLJioi1jLn8s4A jtrjBcyhGLxhFINnoEG+07C7Xrf73S+hMfOsNtepd9je+q/tN5UBKm5CjIv1K5lh2c8pCmAYgt mePzjy4o2m+ca6bD6QauFEsYQVnVvdKvgjnuxiOBH1TXwIJE48JWQvj+UOLYHmMYpVGWPlsTXw PmJvr/Rg4ecHP9ETB3YyErUy9cJ1xx3G8jzGWZ+cxobofIaH50Aw1qPyixN3ntTRDBqpQxTwtH IYo= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v5 20/21] RISC-V: Use 64-bit vdso syscalls for RV32 Date: Thu, 29 Aug 2019 09:50:54 -0700 Message-Id: <7a2929b5d0ddbebe1e7eead00429eb3dabfda00c.1567097252.git.alistair.francis@wdc.com> In-Reply-To: References: MIME-Version: 1.0 Signed-off-by: Alistair Francis * sysdeps/unix/sysv/linux/clock_getres.c: Use 64-bit vdso syscalls for RV32 * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise. --- sysdeps/unix/sysv/linux/clock_getres.c | 4 ++++ sysdeps/unix/sysv/linux/riscv/init-first.c | 19 ++++++++++++------- sysdeps/unix/sysv/linux/riscv/libc-vdso.h | 9 ++++++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c index 24b2299938c..6982c754d6f 100644 --- a/sysdeps/unix/sysv/linux/clock_getres.c +++ b/sysdeps/unix/sysv/linux/clock_getres.c @@ -30,6 +30,10 @@ int __clock_getres (clockid_t clock_id, struct timespec *res) { +#ifndef __vdso_clock_getres + return INLINE_SYSCALL_CALL (clock_getres, clock_id, res); +#else return INLINE_VSYSCALL (clock_getres, 2, clock_id, res); +#endif } weak_alias (__clock_getres, clock_getres) diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c index 35dc8a8d386..7b7457a7a8b 100644 --- a/sysdeps/unix/sysv/linux/riscv/init-first.c +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c @@ -22,12 +22,15 @@ long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *) attribute_hidden; -long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -long int (*VDSO_SYMBOL (__clock_gettime64)) (clockid_t, struct __timespec64 *) +long int (*VDSO_SYMBOL (clock_gettime64)) (clockid_t, struct timespec *) attribute_hidden; + +#if __riscv_xlen == 64 long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) attribute_hidden; +long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) + attribute_hidden; +#endif static inline void _libc_vdso_platform_setup (void) @@ -38,17 +41,19 @@ _libc_vdso_platform_setup (void) PTR_MANGLE (p); VDSO_SYMBOL (getcpu) = p; - p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version); + p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version); PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; + VDSO_SYMBOL (clock_gettime64) = p; - p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version); +#if __riscv_xlen == 64 + p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version); PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; + VDSO_SYMBOL (gettimeofday) = p; p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version); PTR_MANGLE (p); VDSO_SYMBOL (clock_getres) = p; +#endif } #define VDSO_SETUP _libc_vdso_platform_setup diff --git a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h index 16905d5b78d..3684168df4b 100644 --- a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h @@ -24,11 +24,14 @@ extern long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *) attribute_hidden; -extern long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -extern long int (*VDSO_SYMBOL (__clock_gettime64)) (clockid_t, struct __timespec64 *) +extern long int (*VDSO_SYMBOL (clock_gettime64)) (clockid_t, struct timespec *) attribute_hidden; + +#if __riscv_xlen == 64 extern long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) attribute_hidden; +extern long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) + attribute_hidden; +#endif #endif /* _LIBC_VDSO_H */