World of Warcraft (WoW) patch/more address space layout stuff

Mike Hearn mike at plan99.net
Mon May 1 05:59:01 CDT 2006


(yeah i'm bored :/)

Seems the WoW appdb page (apart from being a great example of what an
appdb entry should be like!) recommends users patch their Wine to run WoW
properly.

The patch is this one, which I am SURE we discussed before but I can't
find the thread! So my questions are:

 * Is this working around a bug in WoW? (my guess - almost certainly yes)

 * What exactly is it doing?! No comments! It seems to be forcing the
   kernel to follow an NT allocation pattern.

 * How should we fix this properly? Forcing the rtld to map every DSO in a
   predictable manner seems awfully hard work. Likewise, kernel patches 
   would kind of suck ...Is this approach of a new preloader
   region and then doing manual mmap management going to work?
   
These are questions for Alexandre really but if nobody has any better
ideas then maybe we should try and incorporate allocation patterns into
our test suite and match Windows. Seems very lame for users to have to patch the 
preloader to play a game as popular as WoW is.

thanks -mike

mike at linux:~/Downloads> cat wow.patch.0.9.11
--- wine/libs/wine/mmap.c.orig  2006-01-27 04:58:28.000000000 -0900
+++ wine/libs/wine/mmap.c       2006-01-27 05:00:46.000000000 -0900
@@ -164,7 +164,26 @@

 #endif  /* (__svr4__ || __NetBSD__) && !MAP_TRYFIXED */

+static void *get_anon_mmap_null_address(size_t size)
+{
+    static int got_override = 0;
+    static void *low_alloc_ptr = NULL;
+    void * current_low_alloc_ptr;
+
+    if (!got_override)
+    {
+            low_alloc_ptr = (void*)0x10000000;
+            got_override = 1;
+    }

+    current_low_alloc_ptr = low_alloc_ptr;
+
+    if (low_alloc_ptr)
+        low_alloc_ptr += size;
+
+    return current_low_alloc_ptr;
+   }
+
 /***********************************************************************
  *             wine_anon_mmap
  *
@@ -212,6 +231,8 @@
             return start;
 #endif
     }
+     if ((start == NULL) && !(flags & MAP_FIXED))
+            start = get_anon_mmap_null_address(size);
     return mmap( start, size, prot, flags, fdzero, 0 );
 #else
     return (void *)-1;

--- wine/loader/preloader.c.orig        2006-01-27 04:58:29.000000000 -0900
+++ wine/loader/preloader.c     2006-01-27 05:00:46.000000000 -0900
@@ -109,8 +109,8 @@
 static struct wine_preload_info preload_info[] =
 {
     { (void *)0x00000000, 0x00110000 },  /* DOS area */
-    { (void *)0x7ffe0000, 0x01020000 },  /* shared user data + shared heap */
-    { (void *)0x00110000, 0x1fef0000 },  /* PE exe range (may be set with WINEPRELOADRESERVE), defaults to 512mb */
+    { (void *)0x80000000, 0x01000000 },  /* shared user data + shared heap */
+    { (void *)0x10000000, 0x00f00000 },  /* PE exe range (may be set with WINEPRELOADRESERVE), defaults to 512mb */
     { 0, 0 }                             /* end of list */
 };






More information about the wine-devel mailing list