summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/miscfuncs.cc32
2 files changed, 21 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 415be6df3..187046931 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,9 @@
2011-05-15 Corinna Vinschen <corinna@vinschen.de>
+ * miscfuncs.cc (thread_wrapper): Add comments to assembler code.
+
+2011-05-15 Corinna Vinschen <corinna@vinschen.de>
+
* cygwin.din (pthread_attr_getguardsize): Export.
(pthread_attr_setguardsize): Export.
(pthread_attr_setstack): Export.
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 0e2945125..73dec4c1a 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -421,15 +421,16 @@ thread_wrapper (VOID *arg)
+ wrapper_arg.stacksize
- sizeof (PVOID));
__asm__ ("\n\
- movl %[WRAPPER_ARG], %%ebx \n\
- movl (%%ebx), %%eax \n\
- movl 4(%%ebx), %%ecx \n\
- movl 8(%%ebx), %%edx \n\
- xorl %%ebp, %%ebp \n\
- movl %%edx, %%esp \n\
- pushl %%ecx \n\
- pushl %%eax \n\
- jmp *%%eax \n" : : [WRAPPER_ARG] "r" (&wrapper_arg));
+ movl %[WRAPPER_ARG], %%ebx # Load &wrapper_arg into ebx \n\
+ movl (%%ebx), %%eax # Load thread func into eax \n\
+ movl 4(%%ebx), %%ecx # Load thread arg into ecx \n\
+ movl 8(%%ebx), %%edx # Load stackbase into edx \n\
+ xorl %%ebp, %%ebp # Set ebp to 0 \n\
+ movl %%edx, %%esp # Set esp to stackbase \n\
+ pushl %%ecx # Push thread arg onto stack \n\
+ pushl %%eax # Push thread func onto stack \n\
+ jmp *%%eax # Jump to thread func \n"
+ : : [WRAPPER_ARG] "r" (&wrapper_arg));
}
if (wrapper_arg.guardsize)
@@ -446,12 +447,13 @@ thread_wrapper (VOID *arg)
system_printf ("VirtualAlloc, %E");
}
__asm__ ("\n\
- movl %[WRAPPER_ARG], %%ebx \n\
- movl (%%ebx), %%eax \n\
- movl 4(%%ebx), %%ecx \n\
- pushl %%ecx \n\
- pushl %%eax \n\
- jmp *%%eax \n" : : [WRAPPER_ARG] "r" (&wrapper_arg));
+ movl %[WRAPPER_ARG], %%ebx # Load &wrapper_arg into ebx \n\
+ movl (%%ebx), %%eax # Load thread func into eax \n\
+ movl 4(%%ebx), %%ecx # Load thread arg into ecx \n\
+ pushl %%ecx # Push thread arg onto stack \n\
+ pushl %%eax # Push thread func onto stack \n\
+ jmp *%%eax # Jump to thread func \n"
+ : : [WRAPPER_ARG] "r" (&wrapper_arg));
/* Never reached. */
return ERROR_INVALID_FUNCTION;
}