Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Mar 2007 20:24:21 +0100
From:      Tijl Coosemans <tijl@ulyssis.org>
To:        freebsd-emulation@freebsd.org
Cc:        Alexander Leidinger <Alexander@leidinger.net>, Scot Hetzel <swhetzel@gmail.com>, gerald@freebsd.org
Subject:   Re: emulators/linux-wine: Help in porting to FreeBSD
Message-ID:  <200703092024.23577.tijl@ulyssis.org>
In-Reply-To: <20070306150107.p9j3cmqzlkww48sk@webmail.leidinger.net>
References:  <790a9fff0610132255k5c3b08fcrb550fa308d31752d@mail.gmail.com> <20070306150107.p9j3cmqzlkww48sk@webmail.leidinger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 06 March 2007 15:01, Alexander Leidinger wrote:
> Quoting Scot Hetzel <swhetzel@gmail.com> (from Sat, 14 Oct 2006  
> 00:55:17 -0500):
> 
> > I'm trying to create a port for emulators/linux-wine, so that we can
> > at least have wine running on FreeBSD/amd64 using the linuxator.  This
> > would then silence users who want wine (amd64/104311) to run under
> > FreeBSD/amd64.
> >
> > Currently, I am having a problem running linux-wine.  When it is run
> > as either root or as a user I get the following error:
> >
> > $ /compat/linux/usr/bin/wine
> > wine: failed to initialize: /usr/lib/wine/ntdll.dll.so: failed to map
> > segment from shared object: Cannot allocate memory
> 
> Do you get the same error with a recent current? I hope it may be  
> fixed with the mmap changes. But it may also be the way the memory is  
> laid out in FreeBSD vs. Linux. IIRC the native wine had a similar  
> problem until someone fixed the code for wine on FreeBSD. But I'm not  
> sure about this.

This is a problem with the FreeBSD mmap.

* The wine executable is loaded at 0x7bf00000.
* It reserves 0x00000000-0x60000000 and 0x80000000-(stack).
* Then a couple dlls are dlopen'ed (ntdll,kernel32,...).
* This fails because the freebsd mmap, when called without MAP_FIXED
  and NULL for the addr argument, looks for free space after the
  executable + maximum possible data segment (to preserve space for
  brk(2) style allocations). The default maximum data segment size is
  512MiB, so mmap is looking for free space well beyond 0x80000000
  which isn't there.

In current you could work around this by setting kern.maxdsiz="8M" or
so in /boot/loader.conf, but that probably causes problems for programs
that use brk(2). A better solutions would be to create a wrapper
program that reduces the data segment size with setrlimit(2) and then
runs wine with execv(3).

Anyway, I don't think that will give you a better Wine than the native
version. FreeBSD devices are not the same as on Linux for instance.



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