32-bit binaries (e.g. wine) and 64-bit kernel structures
Li-Lun "Leland" Wang
llwang at infor.org
Sun Oct 23 23:27:28 UTC 2011
Although I only encounter this kind of problem when running wine
(because it is one of the few ports that need to compile into 32-bit),
it is a problem of i386 binaries on x64 FreeBSD in general.
The problem that I'm running into recently is
In short, wine recently implemented GetUdpTable() for Mac OS and BSD.
It uses sysctlbyname() to get net.inet.udp.pcblist, and parses it into
xinpgen structures. However, the size of xinpgen is different on i386
and x64. As a result, when I run applications that call
GetUdpTable(), the kernel supplies wine with 64-bit structures, while
wine expects 32-bit structures, and crashes. They decided that this
is a FreeBSD bug rather than a wine bug, and that the kernel or LD
should know a 32-bit binary is being run and return proper structures,
as is done in Mac OS.
xinpgen is not the only structure of wrong sizes for 32-bit binaries
on x64. A while ago I was trying to make my usb gamepad work on wine
using the ugen device. libusbhid uses ioctl to get the
usb_gen_descriptor structure, which is also of different sizes on i386
and x64. I had to manually "pad" the pointers to 64-bit and build a
custom libusbhid for it to work.
As it stands, they will probably not fix GetUdpTable() on wine side,
and any windows applications that uses GetUdpTable() will not run
properly in wine on FreeBSD x64. Do we have plans to fix this kind of
problems in general? Although wine port on FreeBSD is only supported
for ARCH=i386, could there be workarounds?
More information about the freebsd-amd64