Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2011 13:27:07 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        John Wehle <john@feith.com>
Cc:        amd64@freebsd.org
Subject:   Re: amd64/155903: FreeBSD32 emulation patch to support i386 X11 Server
Message-ID:  <20110324112707.GD78089@deviant.kiev.zoral.com.ua>
In-Reply-To: <201103240510.p2O5A9YJ057936@red.freebsd.org>
References:  <201103240510.p2O5A9YJ057936@red.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110324112707.GD78089>