From owner-freebsd-amd64@FreeBSD.ORG Thu Mar 24 11:44:45 2011 Return-Path: Delivered-To: amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0317A1065675 for ; Thu, 24 Mar 2011 11:44:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 91D628FC0C for ; Thu, 24 Mar 2011 11:44:44 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p2OBR7cs001906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Mar 2011 13:27:07 +0200 (EET) (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.14.4/8.14.4) with ESMTP id p2OBR7gj032891; Thu, 24 Mar 2011 13:27:07 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p2OBR7QK032890; Thu, 24 Mar 2011 13:27:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 24 Mar 2011 13:27:07 +0200 From: Kostik Belousov To: John Wehle Message-ID: <20110324112707.GD78089@deviant.kiev.zoral.com.ua> References: <201103240510.p2O5A9YJ057936@red.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="z9gnJ0FuBGqVysVJ" Content-Disposition: inline In-Reply-To: <201103240510.p2O5A9YJ057936@red.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: amd64@freebsd.org Subject: Re: amd64/155903: FreeBSD32 emulation patch to support i386 X11 Server X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2011 11:44:45 -0000 --z9gnJ0FuBGqVysVJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 24, 2011 at 05:10:09AM +0000, John Wehle wrote: >=20 > >Number: 155903 > >Category: amd64 > >Synopsis: FreeBSD32 emulation patch to support i386 X11 Server > >Confidential: no > >Severity: non-critical > >Priority: low > >Responsible: freebsd-amd64 > >State: open > >Quarter: =20 > >Keywords: =20 > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Thu Mar 24 05:20:00 UTC 2011 > >Closed-Date: > >Last-Modified: > >Originator: John Wehle > >Release: 8.2 > >Organization: > >Environment: > 8.2-RELEASE amd64 > >Description: > The enclosed lightly tested patch extends the FreeBSD32 emulation > so that the i386 X11 server runs on amd64. Specifically tested: >=20 > a) i386 pciconf -v -l >=20 > b) i386 X11 Server 1.9.5 using the VESA driver. >=20 > Changes: >=20 > 1) Fix fd count leakage in the freebsd32_ioctl routines. >=20 > freebsd32_ioctl called fget for a fd and called a subroutine to hand= le > each specific ioctl. It was expected that the subroutine would call > fdrop when done. However many of the subroutines would exit out ear= ly > if copyin encountered an error resulting in fdrop never being called. >=20 > 2) Extend freebsd32_ioctl to handle MEMRANGE_GET, MEMRANGE_SET, and > PCIOCGETCONF. >=20 > 3) Promote ksyms_map / ksyms_unmap to copyout_map / copyout_unmap > as discussed on one of the mailing lists. Necessary in order to > handle PCIOCGETCONF. >=20 > 4) Modify copyout_map / copyout_unmap to handle size =3D=3D 0. All of this looks interesting. First, please split the patch into smaller, logically self-contained parts. E.g. the change to handle fdrop() in one place should be committed separately. Then, I propose to add the compat definitions of MEMRANGE_GET32, SET32 and PCIOCGETCONF_32. Then, we could move the copyin_map/copyout_map. Also, we could fix the sz =3D=3D 0 case. The last commit is the most controversial, in fact. I understand the reason to get the user memory for calling into pciconf ioctls, but this is somewhat ugly. Ideally, the pci_ioctl() would be changed into wrapper and core code, and two wrappers produced, one for the native call path, other for compat32. BTW, would you do the shims for other pciconf ioctls, while there ? >=20 > -- John >=20 > >How-To-Repeat: > Try running i386 X11 server on amd64 ... the X11 server will fail > to find any video cards since the PCIOCGETCONF doesn't work from > 32 bit binaries on amd64. It also has problems with mtrr. >=20 > You can also try running i386 pciconf -v -l which will fail to find > any hardware. --z9gnJ0FuBGqVysVJ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk2LKosACgkQC3+MBN1Mb4gXAwCfVOWgHs033FZKjIt9dgKh+31n 6ZkAn3q/CdK8ztWDK8kFf5Lw2ZkBl6vZ =h+Pj -----END PGP SIGNATURE----- --z9gnJ0FuBGqVysVJ--