Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-05-16 13:55:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-05-16 13:55:18 +0400
commit6d6cfa4840b66c2dc152e7eab915a8ac9c10ef71 (patch)
tree01dd5cde99e17518990bb4efe163a0048281f293 /winsup/cygwin/miscfuncs.cc
parent943e23a49f6f2fcb15cebe37e4c2361cab8f0fe4 (diff)
* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Check if the
requested stack is application-provided within the user heap or an mmapped region. If so, just use it. Add comment to explain why. * miscfuncs.cc (thread_wrapper): If an application-provided stack has been given, implement cygtls area at the stackbase. Fix comment. * mmap.cc (is_mmapped_region): New function. * winsup.h (is_mmapped_region): Declare.
Diffstat (limited to 'winsup/cygwin/miscfuncs.cc')
-rw-r--r--winsup/cygwin/miscfuncs.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 73dec4c1a..a166ca1da 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -410,16 +410,17 @@ thread_wrapper (VOID *arg)
{
/* If the application provided the stack, we must make sure that
it's actually used by the thread function. So what we do here is
- to compute the stackbase of the application-provided stack and
- change the stack pointer accordingly.
-
- NOTE: _my_tls is on the stack created by CreateThread! It's
- unlikely the tls structure will ever exceed 64K, but if
- so, we have to raise the size of the stack in the call
- to CreateThread, too. */
+ to compute the stackbase of the application-provided stack, move
+ _my_tls to the stackbase, and change the stack pointer accordingly. */
+ wrapper_arg.stackaddr = (PVOID) ((PBYTE) wrapper_arg.stackaddr
+ + wrapper_arg.stacksize);
+ _tlsbase = (char *) wrapper_arg.stackaddr;
wrapper_arg.stackaddr = (PVOID) ((PBYTE) wrapper_arg.stackaddr
- + wrapper_arg.stacksize
- - sizeof (PVOID));
+ - CYGTLS_PADSIZE);
+ _tlstop = (char *) wrapper_arg.stackaddr;
+ _my_tls.init_thread ((char *) wrapper_arg.stackaddr,
+ (DWORD (*)(void*, void*)) wrapper_arg.func);
+ wrapper_arg.stackaddr = (PVOID) (_tlstop - sizeof (PVOID));
__asm__ ("\n\
movl %[WRAPPER_ARG], %%ebx # Load &wrapper_arg into ebx \n\
movl (%%ebx), %%eax # Load thread func into eax \n\