From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 24 15:39:26 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AD38B16A4DE; Mon, 24 Jul 2006 15:39:26 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 279DB43D45; Mon, 24 Jul 2006 15:39:26 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.ntplx.net (8.13.7/8.13.7/NETPLEX) with ESMTP id k6OFdO41026474; Mon, 24 Jul 2006 11:39:25 -0400 (EDT) Date: Mon, 24 Jul 2006 11:39:24 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Tijl Coosemans In-Reply-To: <200607241706.08396.tijl@ulyssis.org> Message-ID: References: <200607221914.15826.lofi@freebsd.org> <200607241706.08396.tijl@ulyssis.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-ID: Content-Disposition: inline X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) Cc: freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org, Michael Nottebrock Subject: Re: WINE vs. FreeBSD X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Jul 2006 15:39:26 -0000 On Mon, 24 Jul 2006, Tijl Coosemans wrote: > On Saturday 22 July 2006 19:14, Michael Nottebrock wrote: >> WINE does have certain requirements regarding memory allocation. In >> particular it (or Windows, rather) really wants a few memory ranges >> for itself: >> >> (from wine-0.9.17/loader/preloader.c): >> >> * 0x00000000 - 0x00110000 the DOS area >> * 0x80000000 - 0x81000000 the shared heap >> * ??? - ??? the PE binary load address (usually >> starting at 0x00400000) >> >> The first two are particularly important for WINE running in win98 >> (or earlier) emulation mode, which is currently completely broken on >> FreeBSD, since those two memory ranges tend to be unavailable. > > The reason for the second range is that wine is located way at the end > of the 2G range (0x7bf00000). FreeBSD's mmap preserves heap space after > that (for brk(2) style allocations). This is about 512Mb by default so > everything in 0x7bf00000-0x9bf00000 is unavailable (unless MAP_FIXED is > used of course). > > The DOS area should be available but can't be allocated by wine because > of a FreeBSD specific quirk in its code to work arround another mmap > related problem. > > Both problems can be solved by locating wine at say 0x20000000 instead > of 0x7bf00000. That leaves plenty of space for the windows executable > and allows us to remove mmap related freebsd quirks from wine's code. > > I've attached two patches that accomplish this, but this seems to > trigger other problems, so use at your own risk. If you want to try > them, place them in the port's files/ directory and add a line > containing "USE_AUTOTOOLS= autoconf:259" to the Makefile. This seems to > break wine+libpthread, so I've also changed the port to use libthr > instead. > > For the libpthread experts, I haven't investigated that much further > yet, but libpthread seems to fail in create_stack() from > _pthread_create() from _thr_start_sig_daemon(). See my response to this in a previous reply to this thread. libthr and libpthread use LDT's for TLS. WINE is stomping on them because it doesn't properly create LDTs. This is not a problem with either of the thread libraries and this issue has been known ever since we implemented TLS years ago. -- DE