Alexandre Julliard : libwine: Better heuristic for finding the top of the address space on Linux.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 31 10:38:55 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 6a5d3600ddcacff7abcf8cbf23d2303e880006fa
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6a5d3600ddcacff7abcf8cbf23d2303e880006fa

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jul 31 17:09:34 2006 +0200

libwine: Better heuristic for finding the top of the address space on Linux.

---

 libs/wine/mmap.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c
index a8654dc..28659e1 100644
--- a/libs/wine/mmap.c
+++ b/libs/wine/mmap.c
@@ -338,15 +338,16 @@ #if defined(__i386__) && !defined(__Free
 
     if (stack_ptr >= user_space_limit)
     {
+        char *end = 0;
         char *base = stack_ptr - ((unsigned int)stack_ptr & granularity_mask) - (granularity_mask + 1);
         if (base > user_space_limit) reserve_area( user_space_limit, base );
         base = stack_ptr - ((unsigned int)stack_ptr & granularity_mask) + (granularity_mask + 1);
 #ifdef linux
-        /* Linux heuristic: if the stack top is at c0000000, assume the address space */
-        /* ends there, this avoids a lot of futile allocation attempts */
-        if (base != (char *)0xc0000000)
+        /* Linux heuristic: assume the stack is near the end of the address */
+        /* space, this avoids a lot of futile allocation attempts */
+        end = (char *)(((unsigned long)base + 0x0fffffff) & 0xf0000000);
 #endif
-            reserve_area( base, 0 );
+        reserve_area( base, end );
     }
     else reserve_area( user_space_limit, 0 );
 #endif /* __i386__ */




More information about the wine-cvs mailing list