OSDN Git Service

* miscfuncs.cc (thread_wrapper): Add comments to assembler code.
authorcorinna <corinna>
Sun, 15 May 2011 19:04:40 +0000 (19:04 +0000)
committercorinna <corinna>
Sun, 15 May 2011 19:04:40 +0000 (19:04 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/miscfuncs.cc

index 415be6d..1870469 100644 (file)
@@ -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.
index 0e29451..73dec4c 100644 (file)
@@ -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;
 }