From owner-cvs-all@FreeBSD.ORG Tue Aug 15 13:55:27 2006 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED41516A4DE; Tue, 15 Aug 2006 13:55:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (fw.zoral.com.ua [213.186.206.134]) by mx1.FreeBSD.org (Postfix) with ESMTP id A861B43D4C; Tue, 15 Aug 2006 13:55:22 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k7FDtIqo011593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Aug 2006 16:55:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6) with ESMTP id k7FDtIj5042401; Tue, 15 Aug 2006 16:55:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6/Submit) id k7FDtH8L042400; Tue, 15 Aug 2006 16:55:17 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 15 Aug 2006 16:55:17 +0300 From: Kostik Belousov To: David Xu Message-ID: <20060815135517.GB41562@deviant.kiev.zoral.com.ua> References: <200608151245.k7FCjpJo077372@repoman.freebsd.org> <200608150913.52419.jhb@freebsd.org> <200608152134.46359.davidxu@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JP+T4n/bALQSJXh8" Content-Disposition: inline In-Reply-To: <200608152134.46359.davidxu@freebsd.org> User-Agent: Mutt/1.4.2.2i X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=1.9 required=5.0 tests=DNS_FROM_RFC_ABUSE, SPF_NEUTRAL,UNPARSEABLE_RELAY autolearn=no version=3.1.4 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on fw.zoral.com.ua Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, John Baldwin Subject: Re: cvs commit: src/sys/amd64/amd64 support.S X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Aug 2006 13:55:27 -0000 --JP+T4n/bALQSJXh8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 15, 2006 at 09:34:46PM +0800, David Xu wrote: > On Tuesday 15 August 2006 21:13, John Baldwin wrote: > > On Tuesday 15 August 2006 08:45, David Xu wrote: > > > davidxu 2006-08-15 12:45:51 UTC > > > > > > FreeBSD src repository > > > > > > Modified files: > > > sys/amd64/amd64 support.S > > > Log: > > > Because fuword on AMD64 returns 64bit long integer -1 on fault, cle= ar > > > entire %rax to zero instead of only clearing %eax, otherwise it will > > > leave garbage data in upper 32 bits. > > > > Are you sure that 'xorl %eax,%eax' doesn't actually clear all 64 bits?= =20 > > This practice of just using xorl rather than xorq is all over the place= in > > the amd64 code, and I think I've even seen gcc generate it, so I'm gues= sing > > that the xorl actually is a xorq. >=20 > >From my understanding, they are different. >=20 > before my change, generated binary code: >=20 > 0000000000003ba0 : > 3ba0: 65 48 8b 0c 25 20 00 mov %gs:0x20,%rcx > 3ba7: 00 00 > 3ba9: 31 c0 xor %eax,%eax > 3bab: 48 89 81 a8 02 00 00 mov %rax,0x2a8(%rcx) > 3bb2: 48 ff c8 dec %rax > 3bb5: c3 retq > 3bb6: 66 data16 > 3bb7: 66 data16 > 3bb8: 66 data16 >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > after this change: >=20 > 0000000000003ba0 : > 3ba0: 65 48 8b 0c 25 20 00 mov %gs:0x20,%rcx > 3ba7: 00 00 > 3ba9: 48 31 c0 xor %rax,%rax > 3bac: 48 89 81 a8 02 00 00 mov %rax,0x2a8(%rcx) > 3bb3: 48 ff c8 dec %rax > 3bb6: c3 retq >=20 >=20 > I have only checked fuword while I am working on userland mutex > priority propagating, I have not checked suword and others yet. =46rom the IA32 Software Developer Manual, 3.4.1.1: When in 64-bit mode, operand size determines the number of valid bits in the destination general-purpose register: 64-bit operands generate a 64-bit result in the destination general-purpose register. 32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register. So, it seems that xorq %rax, %rax and xorl %eax, %eax will make the same results, but in the different ways. And xorq requires REX prefix, that shall make the decoding longer. --JP+T4n/bALQSJXh8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFE4dJFC3+MBN1Mb4gRAlUoAKDmt4xrO5EmGkp49S+MUnhYkbOKYwCfUBb8 qKGxk+VxNPQqPxmMurxaEZo= =7l+g -----END PGP SIGNATURE----- --JP+T4n/bALQSJXh8--