svn commit: r213852 - in head: lib/libusb sys/dev/usb

Kostik Belousov kostikbel at gmail.com
Sat Oct 16 10:00:55 UTC 2010


On Sat, Oct 16, 2010 at 11:41:31AM +0200, Hans Petter Selasky wrote:
> On Saturday 16 October 2010 10:12:37 Kostik Belousov wrote:
> > On Thu, Oct 14, 2010 at 08:38:18PM +0000, Hans Petter Selasky wrote:
> > > Author: hselasky
> > > Date: Thu Oct 14 20:38:18 2010
> > > New Revision: 213852
> > > URL: http://svn.freebsd.org/changeset/base/213852
> > > 
> > > Log:
> > >   - Add support for LibUSB in 32-bit compatibility mode.
> > >   
> > >   Approved by:    thompsa (mentor)
> > > 
> > > Modified:
> > >   head/lib/libusb/Makefile
> > >   head/lib/libusb/libusb20.c
> > >   head/lib/libusb/libusb20_int.h
> > >   head/lib/libusb/libusb20_ugen20.c
> > >   head/sys/dev/usb/usb_ioctl.h
> > > 
> > > Modified: head/lib/libusb/Makefile
> > > =========================================================================
> > > ===== --- head/lib/libusb/Makefile	Thu Oct 14 20:31:07 2010	(r213851)
> > > +++ head/lib/libusb/Makefile	Thu Oct 14 20:38:18 2010	(r213852)
> > > @@ -30,5 +30,9 @@ SRCS+=		libusb10.c
> > > 
> > >  SRCS+=		libusb10_desc.c
> > >  SRCS+=		libusb10_io.c
> > > 
> > > +.if defined(COMPAT_32BIT)
> > > +CFLAGS+=	-DCOMPAT_32BIT
> > > +.endif
> > > +
> > > 
> > >  .include <bsd.lib.mk>
> > 
> > The support is provided in a way that contradicts the established practice
> > of doing 32-bit compat. Very nice that the support is provided, thank you
> > for care about it. But, can it be changed so that the kernel emulates
> > 32-bit ABI instead of library conforming to the kernel ABI ?
> 
> The short answer is yes, but it adds much more code than in the existing 
> approach, with regard to USB. It is not all about IOCTL's it is also about 
> shared memory layout. The existing approach means:
> 
> You need to compile /usr/lib32/ and use that with the 32-bit binaries. I.E. I 
> want to have the 32->64 bit conversion in user-space, hence as per 
Right, I undestand this, and I pointed that there are some scenarious
that do not work with this approach. All other FreeBSD subsystems try
to implement native 32bit ABI instead of providing usermode compatibility
shims.

> implementation in the kernel, there are no pointer mappings involved. It is 
> simply a matter of zero-extending the pointer variable from 32-bit to 64-bit.
> 
> > 
> > For COMPAT32, we aim in making the system where 32bit binaries and
> > libraries just work on the 64bit host. Your change does not allow to take
> > 32bit host into jail and run it on 64bit kernel, as example.
> 
> USB has some shared memory structures which are used in both user-land and 
> kernel, which are not part of IOCTLs. Your approach means that there are two 
> sets of IOCTL's of all kinds, one for 32-bit and one for 64-bit?
For all kinds of structures that are not ABI-invariant, yes.

> 
> > 
> > Please see numerous examples of ioctl translations under
> > #ifdef COMPAT_FREEBSD32 on how it is done.
> 
> Please find attached a patch to fix libusbhid world breakage. Sorry about 
> that. I will do some more checing and see if more is broken. I will commit 
> this as soon as I get a go.
-------------- 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/svn-src-head/attachments/20101016/027662a3/attachment.pgp


More information about the svn-src-head mailing list