From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48258 invoked by alias); 6 Feb 2020 10:03:12 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 48242 invoked by uid 89); 6 Feb 2020 10:03:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Feb 2020 10:03:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580983389; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=+EF4fYIlyGKRyecIOMwJXw/vcIQiYHXofQbftbrS51U=; b=aXH8FcTuGXBM4iF4RxwIACdZAC+gMflUpguFreOcDFPkISrKPjAivCJOfhlZBIBLu22u1Y sCjVk8iT2zWbArb2ipK5xEFTJAHnvp8ojmsi1Y1RoPBXzpbbW+FMckV0pLqldYExM0nlR2 fhYxf5nFXOB2ZoC5nw9VkmMzTHQ5NoE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-gTkgCbq6O4Skq74y_iugYQ-1; Thu, 06 Feb 2020 05:03:07 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 393B4DB60 for ; Thu, 6 Feb 2020 10:03:06 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-116-83.ams2.redhat.com [10.36.116.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 093668EA1A for ; Thu, 6 Feb 2020 10:03:06 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id A0F12A808C0; Thu, 6 Feb 2020 11:03:04 +0100 (CET) Date: Thu, 06 Feb 2020 10:03:00 -0000 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: [PATCH] libgloss: Fix lseek semihosting bug on nios2 and m68k Message-ID: <20200206100304.GL3403@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <20200205043413.23573-1-sandra@codesourcery.com> MIME-Version: 1.0 In-Reply-To: <20200205043413.23573-1-sandra@codesourcery.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="m51xatjYGsM+13rf" Content-Disposition: inline X-SW-Source: 2020/txt/msg00070.txt --m51xatjYGsM+13rf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1726 On Feb 4 21:34, Sandra Loosemore wrote: > When off_t is 32 bits, the value needs to be sign-extended to 64 bits > before shifting right to extract the high-order word. Previously > negative offsets were incorrectly encoded. >=20 > Signed-off-by: Sandra Loosemore > --- > libgloss/m68k/io-lseek.c | 2 +- > libgloss/nios2/io-lseek.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/libgloss/m68k/io-lseek.c b/libgloss/m68k/io-lseek.c > index 63ec564..eaaf557 100644 > --- a/libgloss/m68k/io-lseek.c > +++ b/libgloss/m68k/io-lseek.c > @@ -38,7 +38,7 @@ off_t lseek (int fd, off_t offset, int whence) > #if HOSTED > gdb_parambuf_t parameters; > parameters[0] =3D (uint32_t) fd; > - parameters[1] =3D (uint32_t) ((offset >> 32) & 0xffffffff); > + parameters[1] =3D (uint32_t) ((int64_t)offset >> 32); > parameters[2] =3D (uint32_t) (offset & 0xffffffff); > parameters[3] =3D __hosted_to_gdb_lseek_flags (whence); > __hosted (HOSTED_LSEEK, parameters); > diff --git a/libgloss/nios2/io-lseek.c b/libgloss/nios2/io-lseek.c > index bfc23c1..d47fe07 100644 > --- a/libgloss/nios2/io-lseek.c > +++ b/libgloss/nios2/io-lseek.c > @@ -39,7 +39,7 @@ off_t lseek (int fd, off_t offset, int whence) > #if HOSTED > gdb_parambuf_t parameters; > parameters[0] =3D (uint32_t) fd; > - parameters[1] =3D (uint32_t) ((offset >> 32) & 0xffffffff); > + parameters[1] =3D (uint32_t) ((int64_t)offset >> 32); > parameters[2] =3D (uint32_t) (offset & 0xffffffff); > parameters[3] =3D __hosted_to_gdb_lseek_flags (whence); > __io_hosted (HOSTED_LSEEK, parameters); > --=20 > 2.8.1 Pushed. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --m51xatjYGsM+13rf Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl475FgACgkQ9TYGna5E T6BLrBAAidhn5K17ceAsbY4UQxLepEihT4mLqX4n/cFUS/qMPOTbaS0OAvuV/qFt pGItS04gFICQ5Gdx2W2Z3C/LdGJzgOifq3Y3iY1Qi0kkWFXxtkAim/6xoM2Y0nAx 7U/NDpEJG08gLUgH5BxQdzpENGvcu7TVzdgEpeeiQEOC4mIV+oh2bjpAnP5And9e wVVQb/ZvPe9p5LV67mSxUTx6p9qG3aNlbd0CU0KJ0V6AiGzlzbt1U2p3wng5ODkN D9oSd/ytsZLcTz+lNkX1zSCT1iPGYbnh4MNYnxbNY7tdgC2mo4XIKYF5wVrsbVir dKODmcFuonqdY6AjMYXDDHmKWT95eGbeGohmxiWyb8s3KsV3ozYWRiM3ku64O9bP ubgtk5oa/olBabmq+TumBsW+k07hI4PIohBYjDSmcM5ZDNmYKTqYbHf6Vut2PLGF OmtJrMnYsy2P506TUZw3/7gKV/DuOfBhcin25d4Chsr3FZboGKQr8aXfK3Kk21mk 7Lnr2gc6XdX59IEO8kysuiqtZDrdH9Gb0P3nSuK4PmtyAdXr9LXRZkRfR2PosMxR SwcN6Ts2pDnYEjUcRHvJm/QTBuKDSIFjiCxCwlEp3bUb8Zt5tN+FJltOJpBDlUSH O+JcoIY7/npDBsvl7Q3jhkxwdWI0QCAWktTBFAOWDX4YekiRJU4= =kGT1 -----END PGP SIGNATURE----- --m51xatjYGsM+13rf--