From e7f6a31bb07e96eed5ffb7b8d137051292532930 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 2 Dec 2005 03:12:06 +0000 Subject: [PATCH] * dcrt0.cc (getstack): Try harder to modify memory. (alloc_stack): Alloc page prior to stack top, too. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/dcrt0.cc | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 152dbcd15..f7c6b9690 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2005-12-01 Christopher Faylor + + * dcrt0.cc (getstack): Try harder to modify memory. + (alloc_stack): Alloc page prior to stack top, too. + 2005-12-01 Christopher Faylor * devices.h (_major): Revert previous ill-advised change. diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index c88d43d23..dd5731a3e 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -504,9 +504,10 @@ alloc_stack_hard_way (child_info_fork *ci, volatile char *b) void *getstack (void *) __attribute__ ((noinline)); volatile char * -getstack (volatile char *p) +getstack (volatile char * volatile p) { - *p |= 0; + *p ^= 1; + *p ^= 1; return p - 4096; } @@ -515,13 +516,14 @@ getstack (volatile char *p) static void alloc_stack (child_info_fork *ci) { - volatile char *esp; + volatile char * volatile esp; __asm__ volatile ("movl %%esp,%0": "=r" (esp)); if (_tlsbase != ci->stackbottom) alloc_stack_hard_way (ci, esp); else { - while (_tlstop > ci->stacktop) + char *stacktop = (char *) ci->stacktop - 4096; + while (_tlstop >= stacktop) esp = getstack (esp); ci->stacksize = 0; }