amd64/155903: FreeBSD32 emulation patch to support i386 X11 Server

Kostik Belousov kostikbel at gmail.com
Thu Mar 24 11:44:45 UTC 2011


On Thu, Mar 24, 2011 at 05:10:09AM +0000, John Wehle wrote:
> 
> >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:        
> >Keywords:       
> >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:
> 
>   a) i386 pciconf -v -l
> 
>   b) i386 X11 Server 1.9.5 using the VESA driver.
> 
> Changes:
> 
>   1) Fix fd count leakage in the freebsd32_ioctl routines.
> 
>      freebsd32_ioctl called fget for a fd and called a subroutine to handle
>      each specific ioctl.  It was expected that the subroutine would call
>      fdrop when done.  However many of the subroutines would exit out early
>      if copyin encountered an error resulting in fdrop never being called.
> 
>   2) Extend freebsd32_ioctl to handle MEMRANGE_GET, MEMRANGE_SET, and
>      PCIOCGETCONF.
> 
>   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.
> 
>   4) Modify copyout_map / copyout_unmap to handle size == 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 == 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 ?
> 
> -- John
> 
> >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.
> 
> You can also try running i386 pciconf -v -l which will fail to find
> any hardware.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20110324/a062d63f/attachment.pgp


More information about the freebsd-amd64 mailing list