* debug.cc (makethread): Eliminate unneeded function call.
* miscfuncs.cc (tls_ix): Predefine. * perthread.h (set_reent): Eliminate. (get_reent): Ditto. * winbase.h (my_tlsalloc): Use global stack base pointer. Set newly allocated location to NULL. (my_tlssetvalue): Use global stack base pointer. (my_tlsgetvalue): Ditto.
This commit is contained in:
		| @@ -1,3 +1,14 @@ | |||||||
|  | 2001-11-30  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
|  | 	* debug.cc (makethread): Eliminate unneeded function call. | ||||||
|  | 	* miscfuncs.cc (tls_ix): Predefine. | ||||||
|  | 	* perthread.h (set_reent): Eliminate. | ||||||
|  | 	(get_reent): Ditto. | ||||||
|  | 	* winbase.h (my_tlsalloc): Use global stack base pointer.  Set newly | ||||||
|  | 	allocated location to NULL. | ||||||
|  | 	(my_tlssetvalue): Use global stack base pointer. | ||||||
|  | 	(my_tlsgetvalue): Ditto. | ||||||
|  |  | ||||||
| 2001-11-27  Christopher Faylor  <cgf@redhat.com> | 2001-11-27  Christopher Faylor  <cgf@redhat.com> | ||||||
|  |  | ||||||
| 	* winsup.h: Reorganize to avoid use of experimental stuff. | 	* winsup.h: Reorganize to avoid use of experimental stuff. | ||||||
|   | |||||||
| @@ -95,7 +95,6 @@ thread_stub (VOID *arg) | |||||||
|      SIGSEGV or SIGFPE. */ |      SIGSEGV or SIGFPE. */ | ||||||
|   init_exceptions (&except_entry); |   init_exceptions (&except_entry); | ||||||
|  |  | ||||||
|   set_reent (user_data->impure_ptr); |  | ||||||
|   ExitThread (threadfunc (threadarg)); |   ExitThread (threadfunc (threadarg)); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ details. */ | |||||||
| #include "cygerrno.h" | #include "cygerrno.h" | ||||||
| #include <sys/errno.h> | #include <sys/errno.h> | ||||||
|  |  | ||||||
| long tls_ix; | long tls_ix = -1; | ||||||
|  |  | ||||||
| const char case_folded_lower[] NO_COPY = { | const char case_folded_lower[] NO_COPY = { | ||||||
|    0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15, |    0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14,  15, | ||||||
|   | |||||||
| @@ -15,27 +15,6 @@ details. */ | |||||||
| struct _reent; | struct _reent; | ||||||
| extern struct _reent reent_data; | extern struct _reent reent_data; | ||||||
|  |  | ||||||
| extern DWORD *__stackbase __asm__ ("%fs:4"); |  | ||||||
|  |  | ||||||
| extern __inline struct _reent * |  | ||||||
| get_reent () |  | ||||||
| { |  | ||||||
|   DWORD *base = __stackbase - 1; |  | ||||||
|  |  | ||||||
|   if (*base != PTMAGIC) |  | ||||||
|     return &reent_data; |  | ||||||
|   return (struct _reent *) base[-1]; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| extern inline void |  | ||||||
| set_reent (struct _reent *r) |  | ||||||
| { |  | ||||||
|   DWORD *base = __stackbase - 1; |  | ||||||
|  |  | ||||||
|   *base = PTMAGIC; |  | ||||||
|   base[-1] = (DWORD) r; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #define PER_THREAD_FORK_CLEAR ((void *)0xffffffff) | #define PER_THREAD_FORK_CLEAR ((void *)0xffffffff) | ||||||
| class per_thread | class per_thread | ||||||
| { | { | ||||||
|   | |||||||
| @@ -42,28 +42,27 @@ extern __inline__ long ilockexch (long *t, long v) | |||||||
| #define InterlockedExchange ilockexch | #define InterlockedExchange ilockexch | ||||||
|  |  | ||||||
| extern long tls_ix; | extern long tls_ix; | ||||||
|  | extern char * volatile *__stackbase __asm__ ("%fs:4"); | ||||||
|  |  | ||||||
| extern __inline__ DWORD | extern __inline__ DWORD | ||||||
| my_tlsalloc () | my_tlsalloc () | ||||||
| { | { | ||||||
|   return (DWORD) ilockincr (&tls_ix); |   DWORD n = ilockdecr (&tls_ix); | ||||||
|  |   __stackbase[tls_ix] = NULL; | ||||||
|  |   return n; | ||||||
| } | } | ||||||
|  |  | ||||||
| extern __inline__ BOOL | extern __inline__ BOOL | ||||||
| my_tlssetvalue (DWORD ix, void *val) | my_tlssetvalue (DWORD ix, void *val) | ||||||
| { | { | ||||||
|   char **stackbase; |   __stackbase[ix] = (char *) val; | ||||||
|   __asm__ volatile ("movl %%fs:4,%0": "=g" (stackbase)); |  | ||||||
|   stackbase[-ix] = (char *) val; |  | ||||||
|   return 1; |   return 1; | ||||||
| } | } | ||||||
|  |  | ||||||
| extern __inline__ void * | extern __inline__ void * | ||||||
| my_tlsgetvalue (DWORD ix) | my_tlsgetvalue (DWORD ix) | ||||||
| { | { | ||||||
|   char **stackbase; |   return __stackbase[ix]; | ||||||
|   __asm__ volatile ("movl %%fs:4,%0": "=g" (stackbase)); |  | ||||||
|   return stackbase[-ix]; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| extern __inline__ BOOL | extern __inline__ BOOL | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user