Date: Sat, 10 Mar 2007 10:38:40 +0100 From: Divacky Roman <xdivac02@stud.fit.vutbr.cz> To: Jung-uk Kim <jkim@freebsd.org> Cc: Alexander Leidinger <Alexander@leidinger.net>, freebsd-emulation@freebsd.org, Scot Hetzel <swhetzel@gmail.com>, gerald@freebsd.org Subject: Re: emulators/linux-wine: Help in porting to FreeBSD Message-ID: <20070310093840.GA45813@stud.fit.vutbr.cz> In-Reply-To: <200703091746.06515.jkim@FreeBSD.org> References: <790a9fff0610132255k5c3b08fcrb550fa308d31752d@mail.gmail.com> <200703092024.23577.tijl@ulyssis.org> <790a9fff0703091251w6b664efbs55a0d608b7c2f441@mail.gmail.com> <200703091746.06515.jkim@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 09, 2007 at 05:46:04PM -0500, Jung-uk Kim wrote: > On Friday 09 March 2007 03:51 pm, Scot Hetzel wrote: > > On 3/9/07, Tijl Coosemans <tijl@ulyssis.org> wrote: > > > 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). > > > > Thanks for the hint, I didn't find kern.maxdsiz in the sysctl tree, > > but I did find 2 other maxdsiz settings. > > > > hp010# sysctl -a | grep maxdsiz > > compat.ia32.maxdsiz: 536870912 > > compat.linux32.maxdsiz: 536870912 > > > > hp010# /compat/linux/usr/bin/wineprefixcreate > > wine: failed to initialize: /usr/lib/wine/ntdll.dll.so: failed to > > map segment from shared object: Cannot allocate memory > > > > hp010# /compat/linux/usr/bin/wine --version > > wine: failed to initialize: /usr/lib/wine/ntdll.dll.so: failed to > > map segment from shared object: Cannot allocate memory > > > > Changing only compat.linux32.maxdsiz to 8M, allowed > > wineprefixcreate to run without giving the above error, but instead > > resulted in a core dump. > > ---- CUT!!! --- > > Segmentation. Wine seems to (ab)use set_thread_area() (to set up > special GDT entry), %fs, and %gs to emulate Windows kernel. I am > sorry to tell you this but there is no way that we can get that fixed > unless we give up performance, i.e., for every context switch, we > have to save and restore three segment registers, their corresponding > base addresses and GDT entries. I have implemented set_thread_area() > for amd64 but that is just not enough to support Wine. yes... linux supports 3 GDT entries for TLS we support just 1. And I dont think we will ever be willing to pay the performance price for the ability to run just 1 (one!!!) program more... but as there is native fbsd version of wine I think we'd better spend our time on fixing/improving the native version my two cents roman
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070310093840.GA45813>