about summary refs log tree commit diff
path: root/linuxthreads/internals.h
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/internals.h')
-rw-r--r--linuxthreads/internals.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h
index aeb45aae01..a78f9b671b 100644
--- a/linuxthreads/internals.h
+++ b/linuxthreads/internals.h
@@ -384,7 +384,11 @@ static inline pthread_descr thread_self (void)
   else if (__pthread_nonstandard_stacks)
     return __pthread_find_self();
   else
+#ifdef _STACK_GROWS_DOWN
     return (pthread_descr)(((unsigned long)sp | (STACK_SIZE-1))+1) - 1;
+#else
+    return (pthread_descr)((unsigned long)sp &~ (STACK_SIZE-1));
+#endif
 #endif
 }