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

[-- Attachment #1 --]

[-- Attachment #2 --]
--- 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) {

[-- Attachment #3 --]
--- 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 */

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