From: Tim Clem tclem@codeweavers.com
This seems to be a holdover from when ntdll was a Mach-O winelib binary, so the reservation needed to be removed before it was dlopen'd. Now that it's PE, unmapping the reservation is unnecessary and leaves time for the system to reclaim it, thus requiring the potentially problematic relocation of ntdll. --- loader/preloader_mac.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/loader/preloader_mac.c b/loader/preloader_mac.c index 8e249a7dc4d..da666b20551 100644 --- a/loader/preloader_mac.c +++ b/loader/preloader_mac.c @@ -90,10 +90,12 @@ static struct wine_preload_info preload_info[] = { (void *)0x00001000, 0x0000f000 }, /* low 64k */ { (void *)0x00010000, 0x00100000 }, /* DOS area */ { (void *)0x00110000, 0x67ef0000 }, /* low memory area */ + { (void *)0x7a000000, 0x02000000 }, /* builtin DLLs (ntdll, kernel32) */ { (void *)0x7f000000, 0x03000000 }, /* top-down allocations + shared heap + virtual heap */ #else /* __i386__ */ { (void *)0x000000010000, 0x00100000 }, /* DOS area */ { (void *)0x000000110000, 0x67ef0000 }, /* low memory area */ + { (void *)0x00007a000000, 0x02000000 }, /* builtin DLLs (ntdll, kernel32) */ { (void *)0x00007ff00000, 0x000f0000 }, /* shared user data */ { (void *)0x000100000000, 0x14000000 }, /* WINE_4GB_RESERVE section */ { (void *)0x7ff000000000, 0x01ff0000 }, /* top-down allocations + virtual heap */ @@ -653,7 +655,6 @@ static void set_program_vars( void *stack, void *mod )
void *wld_start( void *stack, int *is_unix_thread ) { - struct wine_preload_info builtin_dlls = { (void *)0x7a000000, 0x02000000 }; struct wine_preload_info **wine_main_preload_info; char **argv, **p, *reserve = NULL; struct target_mach_header *mh; @@ -692,16 +693,10 @@ void *wld_start( void *stack, int *is_unix_thread ) } }
- if (!map_region( &builtin_dlls )) - builtin_dlls.size = 0; - /* load the main binary */ if (!(mod = pdlopen( argv[1], RTLD_NOW ))) fatal_error( "%s: could not load binary\n", argv[1] );
- if (builtin_dlls.size) - wld_munmap( builtin_dlls.addr, builtin_dlls.size ); - /* store pointer to the preload info into the appropriate main binary variable */ wine_main_preload_info = pdlsym( mod, "wine_main_preload_info" ); if (wine_main_preload_info) *wine_main_preload_info = preload_info;