Alexandre Julliard : loader: Detect pthread_get_stackaddr_np returning the top of the stack

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 25 06:22:27 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 538cd17859318ebcff6a245af21c7afe05b62e4e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=538cd17859318ebcff6a245af21c7afe05b62e4e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jan 24 15:11:58 2006 +0100

loader: Detect pthread_get_stackaddr_np returning the top of the stack
instead of the base.

---

 loader/pthread.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/loader/pthread.c b/loader/pthread.c
index f2f87d7..20cc3a9 100644
--- a/loader/pthread.c
+++ b/loader/pthread.c
@@ -70,8 +70,12 @@ static void init_thread( struct wine_pth
         pthread_getattr_np( pthread_self(), &attr );
         pthread_attr_getstack( &attr, &info->stack_base, &info->stack_size );
 #elif defined(HAVE_PTHREAD_GET_STACKSIZE_NP) && defined(HAVE_PTHREAD_GET_STACKADDR_NP)
+        char dummy;
         info->stack_size = pthread_get_stacksize_np(pthread_self());
         info->stack_base = pthread_get_stackaddr_np(pthread_self());
+        /* if base is too large assume it's the top of the stack instead */
+        if ((char *)info->stack_base > &dummy)
+            info->stack_base = (char *)info->stack_base - info->stack_size;
 #else
         /* assume that the stack allocation is page aligned */
         char dummy;




More information about the wine-cvs mailing list