* miscfuncs.cc (thread_wrapper): Add comments to assembler code.

This commit is contained in:
Corinna Vinschen 2011-05-15 19:04:41 +00:00
parent 7afc14c003
commit daa69fff5b
2 changed files with 21 additions and 15 deletions

View File

@ -1,3 +1,7 @@
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> 2011-05-15 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (pthread_attr_getguardsize): Export. * cygwin.din (pthread_attr_getguardsize): Export.

View File

@ -421,15 +421,16 @@ thread_wrapper (VOID *arg)
+ wrapper_arg.stacksize + wrapper_arg.stacksize
- sizeof (PVOID)); - sizeof (PVOID));
__asm__ ("\n\ __asm__ ("\n\
movl %[WRAPPER_ARG], %%ebx \n\ movl %[WRAPPER_ARG], %%ebx # Load &wrapper_arg into ebx \n\
movl (%%ebx), %%eax \n\ movl (%%ebx), %%eax # Load thread func into eax \n\
movl 4(%%ebx), %%ecx \n\ movl 4(%%ebx), %%ecx # Load thread arg into ecx \n\
movl 8(%%ebx), %%edx \n\ movl 8(%%ebx), %%edx # Load stackbase into edx \n\
xorl %%ebp, %%ebp \n\ xorl %%ebp, %%ebp # Set ebp to 0 \n\
movl %%edx, %%esp \n\ movl %%edx, %%esp # Set esp to stackbase \n\
pushl %%ecx \n\ pushl %%ecx # Push thread arg onto stack \n\
pushl %%eax \n\ pushl %%eax # Push thread func onto stack \n\
jmp *%%eax \n" : : [WRAPPER_ARG] "r" (&wrapper_arg)); jmp *%%eax # Jump to thread func \n"
: : [WRAPPER_ARG] "r" (&wrapper_arg));
} }
if (wrapper_arg.guardsize) if (wrapper_arg.guardsize)
@ -446,12 +447,13 @@ thread_wrapper (VOID *arg)
system_printf ("VirtualAlloc, %E"); system_printf ("VirtualAlloc, %E");
} }
__asm__ ("\n\ __asm__ ("\n\
movl %[WRAPPER_ARG], %%ebx \n\ movl %[WRAPPER_ARG], %%ebx # Load &wrapper_arg into ebx \n\
movl (%%ebx), %%eax \n\ movl (%%ebx), %%eax # Load thread func into eax \n\
movl 4(%%ebx), %%ecx \n\ movl 4(%%ebx), %%ecx # Load thread arg into ecx \n\
pushl %%ecx \n\ pushl %%ecx # Push thread arg onto stack \n\
pushl %%eax \n\ pushl %%eax # Push thread func onto stack \n\
jmp *%%eax \n" : : [WRAPPER_ARG] "r" (&wrapper_arg)); jmp *%%eax # Jump to thread func \n"
: : [WRAPPER_ARG] "r" (&wrapper_arg));
/* Never reached. */ /* Never reached. */
return ERROR_INVALID_FUNCTION; return ERROR_INVALID_FUNCTION;
} }