From patchwork Sat Aug 10 01:00:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1145043 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-104289-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="CxCILGan"; dkim=pass (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="bpE9i8KH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4653pF4Zwvz9s00 for ; Sat, 10 Aug 2019 11:06:13 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=gjZh1D3pbZZtYU8XqmJzc3L38zta5xrjfgCmKUaB+ku+H5o3qrsqz 3XI8DoX6GQK3J5LkAdxXQs/zpmDXPXAQOx7T1+A2yAa3PLv7fmODjJ75u8Gc/5ua b2psrSV+1Nft6mAZbtmiE7BZ82LodySYiloPOEa9gX3Ftb0d+hla9Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=gvnB132PMZcDcOOXh9f5ZOxnEes=; b=CxCILGanS5zPWX94eBFb+rwgrYiY Gm4Hu2gTA2PyUc1BbNhRSXNog1z4KSBJYAAiioMyOfe0YgDTG+e2Gvt8nGsKIj7b p+5PK6kj+H0nyhqZdv0ZyAzXpxK2WbLtpLcPRCybkriMdnlmEQUtWR2yOZGc/t8W 4iVWPVJ6s4i03u8= Received: (qmail 79393 invoked by alias); 10 Aug 2019 01:04:12 -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 79320 invoked by uid 89); 10 Aug 2019 01:04:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 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=HX-Languages-Length:3594 X-HELO: esa3.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=1565399051; x=1596935051; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aSwWF1AFwCdmFEyaiygYWqbu2DnjX/AuXyXc+IQ1SjY=; b=bpE9i8KHlqJlg1q9WcnEVjWatvpJGh+eukKXxA05Tit35tVn1PPI6Mrm Af5W/QpKxR7KjrA39+EPqnm+Fdv2fjs/O4TSB9UZ0/HmgWhI295KItaPM /htdC19SudDwaI8VPu773MMe1w9wGO7m114a05h5T0wYng3SKU6Gmaf0J imwDTIpWDYQgMO55UYm8ul+L3p/u/lRV+CXD6Eqpv4wq6t/3K/0WHQIHw D8CEdHUjXot6kAXhDRXTYu4bnQu3mw04aIS1lfEezayIx5UyLKmhmgTKV jkA0s/w74E93EgfcmyZv8EhLEWTwkKwZKuYxdxdLxL1iaK0qYFxLt/XDR g==; IronPort-SDR: vPiofg6yX6dqm4urN6O3iANKpZ8gKS9+JDIZcDgugUL7VzTnCaS7Mjyx0SMWKo27NWKnruTZlN 88ZAbXgzkTHpU7VtWla39nH1eZLDQgASARdAnLSY62E6pfUA0NCI1rP7tCkWVub1nXuhsk3mqM RVhTr7sRN9xZ21yQDtlXP39cShGRcbBRSR6Sn3AS854C6w4AoVfowMWW0BiM8GpYn8hXug+oQg 4yusSJmHcqRJ/l0ufbgj3nUoprhKL3wFr0V3H92KS68zjs00dR41jZJ9aQ+3Gfnj2ne71Bkgkw yr0= IronPort-SDR: P/6ELn6Fx+uKvMG32Gvnv0pcNk4q7pg5X9vj0eMvtKVSGlbi6snlXXUkBcikxLR9xB1Z2+khdc QWRrcl76lc44SpWJ7UQejkM9HJerccV8rVtPMoFX8xjikmkjMnSIXMr16QaG284Bz8j6Zt99hC PzeF0N3IYmli1T6c6NFYbwg2/tIdq3VplXCIDRvYF09dIIBYoo9y4zEjTFm5LRdBPIJWaPK1DE iPc4iJCYMiCP16iHS0vxkgfJvOYs39pkuMr9EAqGpiVtkcTlLyxskbCdqDAG/FzcE0q7BwW9EM ZIanWmxoOZ05ZXpFdazDAjhn IronPort-SDR: MIw7omyWIIBnqEJhY7JHynrIem7dPwVtD8mbwK9YZ56AdurqYCVSelxPdSegLIxdj/gOh1nP23 ZaLtu0X3jOEEncjaitWKterGMNZ7WJ40rCiz4oLRXJEkzOwvYB27qghU3IzkXLRxGkQVefBNv/ QmtAd6mCReqM26QAU4SnB3YHDHyh1Vg84kYk/J3T0+haaBwKSYEr2lxZo3P6NKrPOj2lMKL9JF kgOMIa0IfxEgXYUysRLrElpZCMEh8FvN1ycl3UG1SDGK9l1xnAHP2ar6EiiajXeQJUMmv1g+f7 qV4= 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 v4 22/24] RISC-V: Use 64-bit vdso syscalls for RV32 Date: Fri, 9 Aug 2019 18:00:50 -0700 Message-Id: <20ecd0e4f9dfe17c60ed85f6b156c54930df602f.1565398514.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 | 4 ++++ sysdeps/unix/sysv/linux/riscv/init-first.c | 26 +++++++++++++++++----- sysdeps/unix/sysv/linux/riscv/libc-vdso.h | 12 +++++++--- 3 files changed, 33 insertions(+), 9 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..e5f72803464 100644 --- a/sysdeps/unix/sysv/linux/riscv/init-first.c +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c @@ -22,12 +22,18 @@ 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 *) + +#if __riscv_xlen == 64 +long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) attribute_hidden; long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) attribute_hidden; +long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) + attribute_hidden; +#else +long int (*VDSO_SYMBOL (clock_gettime64)) (clockid_t, struct timespec *) + attribute_hidden; +#endif static inline void _libc_vdso_platform_setup (void) @@ -38,17 +44,25 @@ _libc_vdso_platform_setup (void) PTR_MANGLE (p); VDSO_SYMBOL (getcpu) = p; - p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version); +#if __riscv_xlen == 32 + p = _dl_vdso_vsym ("__vdso_clock_gettime64", &linux_version); PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - + VDSO_SYMBOL (clock_gettime64) = p; +#else p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; +#endif + +#if __riscv_xlen == 64 + p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version); + PTR_MANGLE (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..da4ec9b2ed7 100644 --- a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h @@ -24,11 +24,17 @@ 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 *) + +#if __riscv_xlen == 64 +extern long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) attribute_hidden; extern long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) attribute_hidden; +extern long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) + attribute_hidden; +#else +extern long int (*VDSO_SYMBOL (clock_gettime64)) (clockid_t, struct timespec *) + attribute_hidden; +#endif #endif /* _LIBC_VDSO_H */