diff options
author | Christopher Faylor <me@cgf.cx> | 2006-04-03 20:04:02 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-04-03 20:04:02 +0400 |
commit | 1a6aafd0312b2b1bace67efcabf3d332723a36d7 (patch) | |
tree | 20c6b5a391dd628d3292086da765044970919c4b /winsup/cygwin/dcrt0.cc | |
parent | 29c2d97a8c61eeee2fd911acbc86464e9159110c (diff) |
* dcrt0.cc (sm): Delete.
(alloc_stack_hard_way): Figure out where the stack lives here rather than
relying on previously filled out information which has been invalid since
1.5.19.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index f65d77213..564e6efbd 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -452,7 +452,6 @@ check_sanity_and_sync (per_process *p) } child_info NO_COPY *child_proc_info = NULL; -static MEMORY_BASIC_INFORMATION NO_COPY sm; #define CYGWIN_GUARD ((wincap.has_page_guard ()) ? \ PAGE_EXECUTE_READWRITE|PAGE_GUARD : PAGE_NOACCESS) @@ -464,10 +463,14 @@ alloc_stack_hard_way (child_info_fork *ci, volatile char *b) MEMORY_BASIC_INFORMATION m; void *newbase; int newlen; - LPBYTE curbot = (LPBYTE) sm.BaseAddress + sm.RegionSize; bool noguard; - if (ci->stacktop > (LPBYTE) sm.AllocationBase && ci->stacktop < curbot) + if (!VirtualQuery ((LPCVOID) &b, &m, sizeof m)) + api_fatal ("fork: couldn't get stack info, %E"); + + LPBYTE curbot = (LPBYTE) m.BaseAddress + m.RegionSize; + + if (ci->stacktop > (LPBYTE) m.AllocationBase && ci->stacktop < curbot) { newbase = curbot; newlen = (LPBYTE) ci->stackbottom - (LPBYTE) curbot; |