Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Sep 2004 01:49:35 -0400
From:      Anish Mistry <mistry.7@osu.edu>
To:        Gerald Pfeifer <gerald@pfeifer.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Wine and mmap
Message-ID:  <200409060149.35764.mistry.7@osu.edu>
In-Reply-To: <Pine.BSF.4.61.0409052314530.44846@acrux.dbai.tuwien.ac.at>
References:  <47158390.20040827112834@ulstu.ru> <Pine.BSF.4.61.0409052312300.44846@acrux.dbai.tuwien.ac.at> <Pine.BSF.4.61.0409052314530.44846@acrux.dbai.tuwien.ac.at>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-00=_vp/OBGSiJ8HFpAB
Content-Type: multipart/signed;
  charset="iso-8859-1";
  protocol="application/pgp-signature";
  micalg=pgp-sha1;
  boundary="Boundary-02=_vp/OB01aRadKGPG";
  name=" "
Content-Transfer-Encoding: 7bit

--Boundary-02=_vp/OB01aRadKGPG
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Sunday 05 September 2004 05:15 pm, Gerald Pfeifer wrote:
> [ John, sorry for the duplicate message; this is the correct one. ]
>
> On Fri, 27 Aug 2004, John Birrell wrote:
> > Anish Mistry <mistry.7@osu.edu> has developed a patch to choose an
> > appropriate mmap address. He posted it to -current. I haven't had time =
to
> > test it.
>
> Thanks for the note.  Will you have time to test/commit this before 5.3?
>
> Anish, do you have any news on this patch?  (Wine has been broken for a
> couple of months now, and it would be great to have at least 5.3 fixed.)
>
Well I guess this is my lucky day.  Apply the attached patch for vm_mmap to=
=20
your kernel and patch the August wine sources with the wine-mmap.patch and=
=20
compile and install wine (be sure to use gmake).  This is working on my dev=
=20
system with 6-CURRENT as of Saturday night.
The wine mmap patch just doesn't reserve the DOS area so DOS programs may n=
ot=20
work.  This seems to just work around a side effect of the kernel mmap patc=
h.
I still think that the kernel mmap patch has issues so I'm hoping Alan can=
=20
give us some feedback.
Anyway this worked for me, YMMV.
=2D-=20
Anish Mistry

--Boundary-02=_vp/OB01aRadKGPG
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQBBO/pvxqA5ziudZT0RAuEcAJ9KVTwau13wE0OiP+DoFV4t8a5p1gCghmKR
OgmAA0fzj7wd6iqtezUw1gI=
=VTFN
-----END PGP SIGNATURE-----

--Boundary-02=_vp/OB01aRadKGPG--

--Boundary-00=_vp/OBGSiJ8HFpAB
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="vm_mmap-wine-6-current.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="vm_mmap-wine-6-current.patch"

--- vm_mmap.c.orig	Thu Aug  5 03:04:33 2004
+++ vm_mmap.c	Wed Aug 18 21:31:13 2004
@@ -208,6 +208,8 @@
 	vm_offset_t addr;
 	vm_size_t size, pageoff;
 	vm_prot_t prot, maxprot;
+	vm_map_t map;
+
 	void *handle;
 	int flags, error;
 	off_t pos;
@@ -276,9 +278,26 @@
 		if (addr == 0 ||
 		    (addr >= round_page((vm_offset_t)vms->vm_taddr) &&
 		    addr < round_page((vm_offset_t)vms->vm_daddr +
-		    lim_max(td->td_proc, RLIMIT_DATA))))
+		    lim_max(td->td_proc, RLIMIT_DATA)))) {
+			/*
+			 * XXX So much dirtyness someone who knows what they are doing
+			 * will want to fix this monstrosity.
+			 */
+			map = &td->td_proc->p_vmspace->vm_map;
+			vm_map_lock(map);
 			addr = round_page((vm_offset_t)vms->vm_daddr +
-			    lim_max(td->td_proc, RLIMIT_DATA));
+				lim_max(td->td_proc, RLIMIT_DATA));
+			if(vm_map_findspace(map, addr, size, &addr) != 0) {
+			/*
+			 * since we can't grab the upper process address space bruteforce it.
+			 */
+				for(addr = 0;addr <= round_page((vm_offset_t)vms->vm_taddr) &&
+					vm_map_findspace(map, addr, size, &addr) != 0
+					;addr += PAGE_SIZE,addr = round_page(addr));
+			}
+			vm_map_unlock(map);
+		}
+
 		PROC_UNLOCK(td->td_proc);
 	}
 	if (flags & MAP_ANON) {

--Boundary-00=_vp/OBGSiJ8HFpAB
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="wine-mmap.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="wine-mmap.patch"

--- libs/wine/mmap.c.orig	Mon Sep  6 01:23:40 2004
+++ libs/wine/mmap.c	Mon Sep  6 01:23:46 2004
@@ -294,7 +294,7 @@
         area = LIST_ENTRY( ptr, struct reserved_area, entry );
         if (!area->base) return;  
     }
-    reserve_dos_area();
+    /*reserve_dos_area();*/
 }
 
 #else /* HAVE_MMAP */

--Boundary-00=_vp/OBGSiJ8HFpAB--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200409060149.35764.mistry.7>