Alexandre Julliard : preloader: Reserve low memory areas in separate chunks .

Alexandre Julliard julliard at winehq.org
Mon Apr 14 17:20:49 CDT 2008


Module: wine
Branch: master
Commit: 195ca1e85f01ac40695fbb6fcf9e9e130265f091
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=195ca1e85f01ac40695fbb6fcf9e9e130265f091

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Apr 14 20:38:17 2008 +0200

preloader: Reserve low memory areas in separate chunks.

---

 loader/preloader.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/loader/preloader.c b/loader/preloader.c
index eef0b72..0ca33fd 100644
--- a/loader/preloader.c
+++ b/loader/preloader.c
@@ -108,7 +108,9 @@
 
 static struct wine_preload_info preload_info[] =
 {
-    { (void *)0x00000000, 0x60000000 },  /* low memory area */
+    { (void *)0x00000000, 0x00010000 },  /* low 64k */
+    { (void *)0x00010000, 0x00100000 },  /* DOS area */
+    { (void *)0x00110000, 0x5fef0000 },  /* low memory area */
     { (void *)0x7f000000, 0x02000000 },  /* top-down allocations + shared heap */
     { 0, 0 },                            /* PE exe range set with WINEPRELOADRESERVE */
     { 0, 0 }                             /* end of list */
@@ -919,7 +921,7 @@ static void preload_reserve( const char *str )
     const char *p;
     unsigned long result = 0;
     void *start = NULL, *end = NULL;
-    int first = 1;
+    int i, first = 1;
 
     for (p = str; *p; p++)
     {
@@ -948,15 +950,22 @@ static void preload_reserve( const char *str )
         start = end = NULL;
     }
 
-    /* check for overlap with low memory area */
-    if ((char *)end <= (char *)preload_info[0].addr + preload_info[0].size)
-        start = end = NULL;
-    else if ((char *)start < (char *)preload_info[0].addr + preload_info[0].size)
-        start = (char *)preload_info[0].addr + preload_info[0].size;
+    /* check for overlap with low memory areas */
+    for (i = 0; preload_info[i].size; i++)
+    {
+        if ((char *)preload_info[i].addr > (char *)0x00110000) break;
+        if ((char *)end <= (char *)preload_info[i].addr + preload_info[i].size)
+        {
+            start = end = NULL;
+            break;
+        }
+        if ((char *)start < (char *)preload_info[i].addr + preload_info[i].size)
+            start = (char *)preload_info[i].addr + preload_info[i].size;
+    }
 
-    /* entry 2 is for the PE exe */
-    preload_info[2].addr = start;
-    preload_info[2].size = (char *)end - (char *)start;
+    while (preload_info[i].size) i++;
+    preload_info[i].addr = start;
+    preload_info[i].size = (char *)end - (char *)start;
     return;
 
 error:




More information about the wine-cvs mailing list