From owner-freebsd-emulation@FreeBSD.ORG Fri Mar 9 20:51: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 6007616A404 for ; Fri, 9 Mar 2007 20:51:31 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.240]) by mx1.freebsd.org (Postfix) with ESMTP id 17AC413C4B4 for ; Fri, 9 Mar 2007 20:51:30 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: by an-out-0708.google.com with SMTP id c24so788509ana for ; Fri, 09 Mar 2007 12:51:30 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CTbsOLEWjYes9QQ1AMFUYbbf9xE51IJsAEdR8/kmt7qIq62WlJtwvO+wjbaJWFARJjgT9zSq5tCtO1oaWGEudjd8XP+Kmw+2z1JynXRhHTQjHBInisiipiH964Sve59gn8O6YWLQXO8Vf+Y42wCdjeHrSLLl8FPUdpDwqPGdbGA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=sO8+eYcKTTw5ydk39eztPJ9+63v0GVqUN+yINTYOOJXx8f2Trn/K00opYqztJSXKHf2ZdGmLTQ7YF4DLznPXsAgwNrCnhY0wp8iBvG4q9a53QXFRoqt6OAlTzoTuplWHMnBVyO/YFHfAQ4vwAxgnL+6Q5wf+uCRh32vkgrC7GLU= Received: by 10.114.12.9 with SMTP id 9mr722782wal.1173473489712; Fri, 09 Mar 2007 12:51:29 -0800 (PST) Received: by 10.100.141.14 with HTTP; Fri, 9 Mar 2007 12:51:28 -0800 (PST) Message-ID: <790a9fff0703091251w6b664efbs55a0d608b7c2f441@mail.gmail.com> Date: Fri, 9 Mar 2007 14:51:28 -0600 From: "Scot Hetzel" To: "Tijl Coosemans" In-Reply-To: <200703092024.23577.tijl@ulyssis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <790a9fff0610132255k5c3b08fcrb550fa308d31752d@mail.gmail.com> <20070306150107.p9j3cmqzlkww48sk@webmail.leidinger.net> <200703092024.23577.tijl@ulyssis.org> Cc: Alexander Leidinger , freebsd-emulation@freebsd.org, 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 20:51:31 -0000 On 3/9/07, Tijl Coosemans 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. hp010# sysctl compat.linux32.maxdsiz=8388608 compat.linux32.maxdsiz: 536870912 -> 8388608 hp010# /compat/linux/usr/bin/wineprefixcreate modify_ldt: Success Segmentation fault (core dumped) hp010$ /compat/linux/usr/bin/wine --version Wine 0.9.24 $ /compat/linux/usr/bin/winemine modify_ldt: Success Segmentation fault (core dumped) Mar 9 14:38:36 hp010 kernel: pid 98889 (wine-preloader), uid 1001: exited on signal 11 (core dumped) Both wineprefixcreate and winemine are core dumping when wine-preloader is run. I tried other settings for maxdsiz ranging from 10-100M, and I found that the highest value that can be set is 47M. Though I did have a problem when setting it to 45M. hp010# sysctl compat.linux32.maxdsiz=46137344 (44M) compat.linux32.maxdsiz: 45088768 -> 46137344 hp010# /compat/linux/usr/bin/wine --version Wine 0.9.24 hp010# sysctl compat.linux32.maxdsiz=47185920 (45M) compat.linux32.maxdsiz: 41943040 -> 47185920 hp010# /compat/linux/usr/bin/wine --version wine: failed to initialize: libm.so.6: failed to map segment from shared object: Cannot allocate memory hp010# sysctl compat.linux32.maxdsiz=48234496 (46M) compat.linux32.maxdsiz: 46137344 -> 48234496 hp010# /compat/linux/usr/bin/wine --version Wine 0.9.24 hp010# sysctl compat.linux32.maxdsiz=49283072 (47M) compat.linux32.maxdsiz: 48234496 -> 49283072 hp010# /compat/linux/usr/bin/wine --version Wine 0.9.24 hp010# sysctl compat.linux32.maxdsiz=50331648 (48M) compat.linux32.maxdsiz: 49283072 -> 50331648 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 So it looks like we may be closer to running linux-wine on FreeBSD/amd64 than what we had originally thought. $ /compat/linux/usr/bin/wineserver $ ps -ax | grep wineserver 98895 ?? Ss 0:00.00 /compat/linux/usr/bin/wineserver Mar 9 14:39:14 hp010 kernel: linux: pid 98895 (wineserver): syscall epoll_create not implemented I can run wineserver manually, but /var/log/messages is showing that it needs epoll_create function, but it doesn't stop wineserver from running. Scot $ uname -a FreeBSD hp010.hetzel.org 7.0-CURRENT FreeBSD 7.0-CURRENT #19: Sat Mar 3 04:48:54 CST 2007 swhetzel@hp010.hetzel.org:/usr/obj/usr/src/7x/sys/GENERIC.debug amd64 -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.