diff options
author | jkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-07-29 10:17:53 +0000 |
---|---|---|
committer | jkeil <jkeil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-07-29 10:17:53 +0000 |
commit | b0132b08f37b2d6f91344df246a6eaad958adcac (patch) | |
tree | 60a85aa5036afe4e29ff5c17ed64bf04c6a13c91 /loader | |
parent | 38060e5ee7781e84e04092c79881f72c0dead165 (diff) |
Pre-allocate some stack space to work around a problem with DLL alloca() code
on a linux kernel.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1412 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r-- | loader/pe_image.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/loader/pe_image.c b/loader/pe_image.c index 55d8ef34dd..5d383c3d29 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -884,19 +884,23 @@ void PE_UnloadLibrary(WINE_MODREF *wm) * due to the PROCESS_Create stuff. */ -#if 0 /* - * so this is a dirty hack. - * Why do we need it? - * - * Disable it for now, let's see if it breaks something + * This is a dirty hack. + * The win32 DLLs contain an alloca routine, that first probes the soon + * to be allocated new memory *below* the current stack pointer in 4KByte + * increments. After the mem probing below the current %esp, the stack + * pointer is finally decremented to make room for the "alloca"ed memory. + * Maybe the probing code is intended to extend the stack on a windows box. + * Anyway, the linux kernel does *not* extend the stack by simply accessing + * memory below %esp; it segfaults. + * The extend_stack_for_dll_alloca() routine just preallocates a big chunk + * of memory on the stack, for use by the DLLs alloca routine. */ -static void This_Is_Dirty_Hack(void) +static void extend_stack_for_dll_alloca(void) { void* mem=alloca(0x20000); *(int*)mem=0x1234; } -#endif /* Called if the library is loaded or freed. @@ -939,9 +943,7 @@ WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved ) break; } TRACE("for %s\n", wm->filename); -#if 0 - This_Is_Dirty_Hack(); -#endif + extend_stack_for_dll_alloca(); retv = entry( wm->module, type, lpReserved ); } |