From patchwork Sun Jun 4 13:42:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 770912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wgfJY2lTwz9s2s for ; Sun, 4 Jun 2017 23:42:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ya2s+Ehz"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; q=dns; s=default; b=qWgY /mri+ejjsF0Ua0MIZrGdrlg2Zh6h370i1SQsFELyPcSYt2KaDktpK+VU1d4thz2b YK3p156vJqvN+JXwZtWlPc74h/eqr5ACyk36KKa/Um9pGfRYGuMsRJ/i1Hnr7y9s nbWIxOy9GjqH1Q55zNPGBazC3ZlSrUI3d+g1274= 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:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; s=default; bh=FFPW1Rw9cA O7QPuH9IvJUoAbwQM=; b=ya2s+EhzNntIXSAt1qP3/yH2TKnKgGFAHmxFpmVQA+ 2a4rQc8JVV+hgwQ0aiJStErgUBYOGeyOXHrnb+3JV8ATnJ8jQfqedP+M99EeqkbU B6Rj4rFY0wqAb9UuPzPrR2sit+bqUdfCNpiLABv31BXoHJ2lVzdMBEl5o4V5xx8b M= Received: (qmail 128917 invoked by alias); 4 Jun 2017 13:42:04 -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 127899 invoked by uid 89); 4 Jun 2017 13:42:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qk0-f194.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=A1MExl6ZNYyxupOUuTZZIH6gDXrLsmU8eUrknoblfWc=; b=TEVlLNhloCejebTbEDgLmuGsOmYOGGtpjijJSSxtemtoWOwDjR++1Jyy8EsowcpNpj VHBgF50hkbP3xt/z0xFLDiwR0OZrkCVjKQ7WV/rs4aniUzajiU+BcH0S/HNSLBlQ45uK zX9bvAMaV0K3WM5Q9QgJeacpgIS3eBLPKzoqIcD2SSzLHT/hVOMz7gT7chnIEaskOYxf VszgJ3Z9KkyAORk8VfdYCFzHgNVQbfFo4JJUnmMmfjkpy9JHHxGGGkEVqPT5nq8VJmbr XPkm5oxruIkcKA3u7z2RYynCnb/O645Cyuo2cQFn5We+Fm+oHpWDGXHpaW8qRc0aKpGS Tn6w== X-Gm-Message-State: AKS2vOy7QZQNYY8IpyyTbypANEHBsa8g9jzn6EuWOEKnKkQLHuF4fAs+ 6fL62vUX25spr4pw/vCWQxq2meqIow== X-Received: by 10.55.33.98 with SMTP id h95mr18966105qkh.246.1496583724901; Sun, 04 Jun 2017 06:42:04 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87tw3xccqn.fsf@linux-m68k.org> References: <1493901791-13438-1-git-send-email-adhemerval.zanella@linaro.org> <7412360d-c776-532b-e22c-dd3f0048cfba@linaro.org> <7f07b067-a074-d670-88b1-3da917451c71@redhat.com> <77f9ac84-620a-a408-c448-14a6978f5d2e@linaro.org> <14aca656-8e0f-01b2-ead6-94a9f200f33e@panix.com> <87tw3xccqn.fsf@linux-m68k.org> From: "H.J. Lu" Date: Sun, 4 Jun 2017 06:42:04 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] posix: Implement preadv2 and pwritev2 To: Andreas Schwab Cc: Zack Weinberg , Florian Weimer , Adhemerval Zanella , Siddhesh Poyarekar , GNU C Library On Sat, Jun 3, 2017 at 8:28 AM, Andreas Schwab wrote: > On Jun 03 2017, "H.J. Lu" wrote: > >> X32 inherits LO_HI_LONG from x86-64. If we change x86-64 >> LO_HI_LONG, x32 needs to redefine LO_HI_LONG. > > Your LO_HI_LONG_FLAGS doesn't work for x32 either. > My patch redefined LO_HI_LONG_FLAGS for x32. Here is an alternate patch which defines different LO_HI_LONGs for x86-64 and x32. Tested on x86-64 and x32. From a9a12a727f6bed053ce1396ec44a754585de4167 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 2 Jun 2017 18:31:16 -0700 Subject: [PATCH] x86-64: Update LO_HI_LONG for p{readv,writev}{64}v2 The kernel interface for p{readv,writev}{64}v is (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, unsigned long pos_l, unsigned long pos_h) Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64 and __ARCH_WANT_COMPAT_SYS_PWRITEV64, (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, off64_t pos) is used for p{readv,writev}{64}v. X32 is the only such target. The LO_HI_LONG macro is used to pass offset to the pos_l and pos_h pair. Since pos_h is ignored when size of offset == sizeof of pos_l, x86-64 has #define LO_HI_LONG(val) (val) But the kernel interface for p{readv,writev}{64}v2 is (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, unsigned long pos_l, unsigned long pos_h, int flags) Except for targets which define __ARCH_WANT_COMPAT_SYS_PREADV64V2 and __ARCH_WANT_COMPAT_SYS_PWRITEV64V2, (unsigned long fd, {const }struct iovec *iov, unsigned long vlen, off64_t pos, int flags) is used for p{readv,writev}{64}v2. X32 is the only such target. Update x86-64 LO_HI_LONG to pass 0 as the high part of the offset argument for p{readv,writev}{64}v2 and define a different LO_HI_LONG for x32 to only pass one argument for offset. Tested on x32 and x86-64. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (LO_HI_LONG): Pass 0 as the high part of offset. * sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h (LO_HI_LONG): New. --- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 2 +- sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 7b8bd79..880e496 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -387,6 +387,6 @@ /* How to pass the off{64}_t argument on p{readv,writev}{64}. */ #undef LO_HI_LONG -#define LO_HI_LONG(val) (val) +#define LO_HI_LONG(val) (val), 0 #endif /* linux/x86_64/sysdep.h */ diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h index f90fcfa..04c73a2 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h @@ -22,4 +22,8 @@ #include #include +/* How to pass the off{64}_t argument on p{readv,writev}{64}. */ +#undef LO_HI_LONG +#define LO_HI_LONG(val) (val) + #endif /* linux/x86_64/x32/sysdep.h */ -- 2.9.4