]> sourceware.org Git - newlib-cygwin.git/commitdiff
Christopher Faylor <cgf@redhat.com>
authorChristopher Faylor <me@cgf.cx>
Mon, 22 Mar 2004 18:30:38 +0000 (18:30 +0000)
committerChristopher Faylor <me@cgf.cx>
Mon, 22 Mar 2004 18:30:38 +0000 (18:30 +0000)
* init.cc (munge_threadfunc): Handle all instances of search_for.
(prime_threads): Test threadfunc_ix[0].

winsup/cygwin/ChangeLog
winsup/cygwin/init.cc

index 8c53e48852d6142a4a8caad04b37b67694955157..4bd05f9ed5fb92ba7d598a4b271a2a55208a721b 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-19  Pierre Humblet  <pierre.humblet@ieee.org>
+           Christopher Faylor  <cgf@redhat.com>
+
+       * init.cc (munge_threadfunc): Handle all instances of search_for.
+       (prime_threads): Test threadfunc_ix[0].
+
 2004-03-21  Christopher Faylor  <cgf@redhat.com>
 
        * cygheap.cc (init_cheap): Set initial_sz to something or suffer
index 58556d80bf55b2df454dc2cc99ea95a037fc832c..af8c0ea39de7a42e46b0436e5cd22d345fceaee3 100644 (file)
@@ -17,7 +17,7 @@ details. */
 
 int NO_COPY dynamically_loaded;
 static char *search_for = (char *) cygthread::stub;
-unsigned threadfunc_ix __attribute__((section ("cygwin_dll_common"), shared)) = 0;
+unsigned threadfunc_ix[8] __attribute__((section ("cygwin_dll_common"), shared));
 DWORD tls_func;
 
 HANDLE sync_startup;
@@ -45,7 +45,7 @@ calibration_thread (VOID *arg)
 void
 prime_threads ()
 {
-  if (!threadfunc_ix)
+  if (!threadfunc_ix[0])
     {
       DWORD id;
       search_for = (char *) calibration_thread;
@@ -58,32 +58,30 @@ prime_threads ()
 static void
 munge_threadfunc ()
 {
+  int i;
   char **ebp = (char **) __builtin_frame_address (0);
-  if (!threadfunc_ix)
+  if (!threadfunc_ix[0])
     {
-      for (char **peb = ebp; peb < (char **) _tlsbase; peb++)
+      char **peb;
+      char **top = (char **) _tlsbase;
+      for (peb = ebp, i = 0; peb < top && i < 7; peb++)
        if (*peb == search_for)
-         {
-           threadfunc_ix = peb - ebp;
-           goto foundit;
-         }
-#ifdef DEBUGGING_HARD
-      system_printf ("non-fatal warning: unknown thread! search_for %p, cygthread::stub %p, calibration_thread %p, possible func offset %p",
-                    search_for, cygthread::stub, calibration_thread, ebp[137]);
-#endif
-      try_to_debug ();
-      return;
+         threadfunc_ix[i++] = peb - ebp;
+      if (!threadfunc_ix[0])
+       {
+         try_to_debug ();
+         return;
+       }
     }
 
-foundit:
-  char *threadfunc = ebp[threadfunc_ix];
+  char *threadfunc = ebp[threadfunc_ix[0]];
   if (threadfunc == (char *) calibration_thread)
     /* no need for the overhead */;
   else
     {
-      ebp[threadfunc_ix] = (char *) threadfunc_fe;
+      for (i = 0; threadfunc_ix[i]; i++)               
+       ebp[threadfunc_ix[i]] = (char *) threadfunc_fe;
       ((char **) _tlsbase)[OLDFUNC_OFFSET] = threadfunc;
-      // TlsSetValue (tls_func, (void *) threadfunc);
     }
 }
 
This page took 0.034628 seconds and 5 git commands to generate.