Date: Sat, 16 Oct 2010 13:00:51 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Andrew Thompson <thompsa@freebsd.org> Subject: Re: svn commit: r213852 - in head: lib/libusb sys/dev/usb Message-ID: <20101016100051.GS2392@deviant.kiev.zoral.com.ua> In-Reply-To: <201010161141.32116.hselasky@freebsd.org> References: <201010142038.o9EKcImV036360@svn.freebsd.org> <20101016081237.GR2392@deviant.kiev.zoral.com.ua> <201010161141.32116.hselasky@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--q05O4hSO92p5GF/S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > > >=20 > > > Log: > > > - Add support for LibUSB in 32-bit compatibility mode. > > > =20 > > > Approved by: thompsa (mentor) > > >=20 > > > 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 > > >=20 > > > Modified: head/lib/libusb/Makefile > > > =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=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 --- 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+=3D libusb10.c > > >=20 > > > SRCS+=3D libusb10_desc.c > > > SRCS+=3D libusb10_io.c > > >=20 > > > +.if defined(COMPAT_32BIT) > > > +CFLAGS+=3D -DCOMPAT_32BIT > > > +.endif > > > + > > >=20 > > > .include <bsd.lib.mk> > >=20 > > The support is provided in a way that contradicts the established pract= ice > > of doing 32-bit compat. Very nice that the support is provided, thank y= ou > > 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 ? >=20 > The short answer is yes, but it adds much more code than in the existing= =20 > approach, with regard to USB. It is not all about IOCTL's it is also abou= t=20 > shared memory layout. The existing approach means: >=20 > You need to compile /usr/lib32/ and use that with the 32-bit binaries. I.= E. I=20 > want to have the 32->64 bit conversion in user-space, hence as per=20 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=20 > simply a matter of zero-extending the pointer variable from 32-bit to 64-= bit. >=20 > >=20 > > 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 ta= ke > > 32bit host into jail and run it on 64bit kernel, as example. >=20 > USB has some shared memory structures which are used in both user-land an= d=20 > kernel, which are not part of IOCTLs. Your approach means that there are = two=20 > 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. >=20 > >=20 > > Please see numerous examples of ioctl translations under > > #ifdef COMPAT_FREEBSD32 on how it is done. >=20 > Please find attached a patch to fix libusbhid world breakage. Sorry about= =20 > that. I will do some more checing and see if more is broken. I will commi= t=20 > this as soon as I get a go. --q05O4hSO92p5GF/S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAky5d9EACgkQC3+MBN1Mb4gK2ACgoGF8W8m8db5tOngENVHWgWu4 DJUAoIirZDtXjqs6weOWkydNEtdlGACv =VTQj -----END PGP SIGNATURE----- --q05O4hSO92p5GF/S--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101016100051.GS2392>