From owner-freebsd-emulation@FreeBSD.ORG Wed Jul 27 21:20:35 2005 Return-Path: X-Original-To: emulation@freebsd.org Delivered-To: freebsd-emulation@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E67D716A41F; Wed, 27 Jul 2005 21:20:35 +0000 (GMT) (envelope-from jm.detrez@cegetel.net) Received: from smtp.cegetel.net (mf00.sitadelle.com [212.94.174.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id A905943D46; Wed, 27 Jul 2005 21:20:33 +0000 (GMT) (envelope-from jm.detrez@cegetel.net) Received: from Portable (80-125-221-14.dti.cegetel.net [80.125.221.14]) by smtp.cegetel.net (Postfix) with ESMTP id 161C91A4282; Wed, 27 Jul 2005 23:20:00 +0200 (CEST) From: "jean-marc DETREZ" To: , Date: Wed, 27 Jul 2005 23:19:57 +0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C59301.C8035880" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcWS732IUJjHNvNyQuabG3niOVxAtw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Message-Id: <20050727212000.161C91A4282@smtp.cegetel.net> X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: barner@FreeBSD.org Subject: patch for libs/wine/mmap.c making wine running on FreeBSD 5.x 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: Wed, 27 Jul 2005 21:20:36 -0000 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C59301.C8035880 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I'm currently testing a patch I've made for unbreaking wine (20050725) on FreeBSD.I'ts seems that like other OS a call to mmap() return not always the desired address range. For NetBSD it appears that a special function was compiled "try_mmap_fixed" who call mmap with MAP_FIXED after verifying that the memory address is free. I'm use this function to Create Heap System at base address 0x80000000 , I didn't always use that function for all calls to mmap because it seems that cause performance issues. I made a little correction of "try_mmap_fixed" because it's seems to me that the function didn't really test the result (vec). I've some feedbacks from users who could run wine on BSD with that patch. Jean-marc. ------=_NextPart_000_0000_01C59301.C8035880 Content-Type: application/octet-stream; name="mmap.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mmap.patch" --- mmap.orig Mon Jun 20 13:43:47 2005=0A= +++ mmap.c Wed Jul 27 22:26:53 2005=0A= @@ -59,7 +59,7 @@ static inline int munmap( void *ptr, siz=0A= #endif=0A= =0A= =0A= -#if (defined(__svr4__) || defined(__NetBSD__)) && !defined(MAP_TRYFIXED)=0A= +#if (defined(__svr4__) || defined(__NetBSD__) || defined (__FreeBSD__)) = && !defined(MAP_TRYFIXED)=0A= /***********************************************************************=0A= * try_mmap_fixed=0A= *=0A= @@ -116,7 +116,7 @@ static int try_mmap_fixed (void *addr, s=0A= If any of these calls succeeds, the page is already=0A= mapped and we must fail. */=0A= for ( i =3D 0; i < len; i +=3D pagesize )=0A= - if ( mincore( (caddr_t)addr + i, pagesize, &vec ) !=3D -1 )=0A= + if ( mincore( (caddr_t)addr + i, pagesize, &vec ) !=3D -1 = && (vec&1))=0A= _exit(1);=0A= =0A= /* Perform the mapping with MAP_FIXED set. This is safe=0A= @@ -159,7 +159,7 @@ static int try_mmap_fixed (void *addr, s=0A= }=0A= }=0A= =0A= -#endif /* (__svr4__ || __NetBSD__) && !MAP_TRYFIXED */=0A= +#endif /* (__svr4__ || __NetBSD__ || __FreeBSD__ ) && !MAP_TRYFIXED */=0A= =0A= =0A= /***********************************************************************=0A= @@ -207,6 +207,13 @@ void *wine_anon_mmap( void *start, size_=0A= #elif defined(__svr4__) || defined(__NetBSD__) || defined(__APPLE__)=0A= if ( try_mmap_fixed( start, size, prot, flags, fdzero, 0 ) )=0A= return start;=0A= +#elif defined(__FreeBSD__)=0A= + /*for FreeBSD assure system heap adress of 0x80000000*/=0A= + if (start =3D=3D (void *)0x80000000)=0A= + {=0A= + if (try_mmap_fixed( start, size, prot, flags, fdzero, 0 ) )=0A= + return start;=0A= + }=0A= #endif=0A= }=0A= return mmap( start, size, prot, flags, fdzero, 0 );=0A= ------=_NextPart_000_0000_01C59301.C8035880--