From owner-freebsd-current@FreeBSD.ORG Sat Aug 28 04:24:07 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DFDD416A4CE for ; Sat, 28 Aug 2004 04:24:07 +0000 (GMT) Received: from green.homeunix.org (pcp04368961pcs.nrockv01.md.comcast.net [69.140.212.7]) by mx1.FreeBSD.org (Postfix) with ESMTP id A25E243D31 for ; Sat, 28 Aug 2004 04:24:03 +0000 (GMT) (envelope-from green@green.homeunix.org) Received: from green.homeunix.org (green@localhost [127.0.0.1]) by green.homeunix.org (8.13.1/8.13.1) with ESMTP id i7S4NVgF005200; Sat, 28 Aug 2004 00:23:31 -0400 (EDT) (envelope-from green@green.homeunix.org) Received: (from green@localhost) by green.homeunix.org (8.13.1/8.13.1/Submit) id i7S4NV4B005199; Sat, 28 Aug 2004 00:23:31 -0400 (EDT) (envelope-from green) Date: Sat, 28 Aug 2004 00:23:31 -0400 From: Brian Fundakowski Feldman To: John Birrell Message-ID: <20040828042331.GD1085@green.homeunix.org> References: <47158390.20040827112834@ulstu.ru> <20040827091556.GM7113@freebsd3.cimlogic.com.au> <1698443921.20040827135316@ulstu.ru> <200408271245.15447.mistry.7@osu.edu> <20040827230502.GS77326@green.homeunix.org> <20040828013612.GN7113@freebsd3.cimlogic.com.au> <20040828040118.GA1085@green.homeunix.org> <20040828040936.GO7113@freebsd3.cimlogic.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040828040936.GO7113@freebsd3.cimlogic.com.au> User-Agent: Mutt/1.5.6i cc: Angry Virus cc: freebsd-current@freebsd.org Subject: Re: Re[2]: Wine and mmap X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2004 04:24:08 -0000 On Sat, Aug 28, 2004 at 02:09:36PM +1000, John Birrell wrote: > On Sat, Aug 28, 2004 at 12:01:18AM -0400, Brian Fundakowski Feldman wrote: > > Is the problem that it specifically runs out of memory area but it's not > > checking where it needs to? If so, I think you could hash out the solution > > with a wrapper/workaround mmap() in userland first. > > The problem is that if the mmap kernel code is left to choose a map address, > it tries to use memory above the highest value allocated. This conflicts with > Wine because Wine needs to reserve the top half of a process' address space > to be compatible with Win9X programs. > > Wine gobbles the upper memory as soon as it can (i.e. just after the base > Wine process is loaded with it's linked libraries - libc). Once the memory > has been reserved, Wine then goes ahead and loads the "DLL" libraries using > the standard dlopen() call. The first one Wine tries to load fails because > the upper-most address used by that time is the top of the process address > space and it all ends in tears. > > What the mmap code needs (IMHO) to do is to find a hole in the address space > if the upper memory is all allocated. Cool, sounds like a wrapper to mmap() that takes care of this for every BSD by allocating 1MB of memory (for i386/amd64 4GB address space compat(?)) and mincore() all possible address space on it then choosing the right area itself.... getpagesize() and mincore() (and doing it in a thread-safe manner) can fix this temporarily for all BSDs in the WINE code, I'd think. -- Brian Fundakowski Feldman \'[ FreeBSD ]''''''''''\ <> green@FreeBSD.org \ The Power to Serve! \ Opinions expressed are my own. \,,,,,,,,,,,,,,,,,,,,,,\