From owner-freebsd-emulation@FreeBSD.ORG Fri Mar 9 19:24:31 2007 Return-Path: X-Original-To: freebsd-emulation@freebsd.org Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B47A916A400 for ; Fri, 9 Mar 2007 19:24:31 +0000 (UTC) (envelope-from tijl@ulyssis.org) Received: from rusty.kulnet.kuleuven.ac.be (rusty.kulnet.kuleuven.ac.be [134.58.240.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3B02413C441 for ; Fri, 9 Mar 2007 19:24:31 +0000 (UTC) (envelope-from tijl@ulyssis.org) Received: from localhost (localhost [127.0.0.1]) by rusty.kulnet.kuleuven.ac.be (Postfix) with ESMTP id D9FC41D73A7; Fri, 9 Mar 2007 20:24:29 +0100 (CET) Received: from smtps01 (octavianus.kulnet.kuleuven.ac.be [134.58.240.71]) by rusty.kulnet.kuleuven.ac.be (Postfix) with ESMTP id DABE71D761C; Fri, 9 Mar 2007 20:24:28 +0100 (CET) Received: from kalimero.kotnet.org (kalimero.kotnet.org [10.4.16.222]) by smtps01 (Postfix) with ESMTP id 870752E68CB; Fri, 9 Mar 2007 20:24:25 +0100 (CET) Received: from kalimero.kotnet.org (kalimero.kotnet.org [127.0.0.1]) by kalimero.kotnet.org (8.13.8/8.13.8) with ESMTP id l29JOOfj002850; Fri, 9 Mar 2007 20:24:24 +0100 (CET) (envelope-from tijl@ulyssis.org) From: Tijl Coosemans To: freebsd-emulation@freebsd.org Date: Fri, 9 Mar 2007 20:24:21 +0100 User-Agent: KMail/1.9.5 References: <790a9fff0610132255k5c3b08fcrb550fa308d31752d@mail.gmail.com> <20070306150107.p9j3cmqzlkww48sk@webmail.leidinger.net> In-Reply-To: <20070306150107.p9j3cmqzlkww48sk@webmail.leidinger.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200703092024.23577.tijl@ulyssis.org> X-Virus-Scanned: by KULeuven Antivirus Cluster Cc: Alexander Leidinger , Scot Hetzel , gerald@freebsd.org Subject: Re: emulators/linux-wine: Help in porting to FreeBSD X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2007 19:24:31 -0000 On Tuesday 06 March 2007 15:01, Alexander Leidinger wrote: > Quoting Scot Hetzel (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.