mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
Update.
* sysdeps/i386/tls.h (THREAD_GETMEM_NC): Change interface. It now takes the array member name and the index as parameters. (THREAD_SETMEM_NC): Likewise. * pthread_getspecific.c: Use new THREAD_GETMEM_NC interface. * pthread_setspecific.c: Use new THREAD_GETMEM_NC and THREAD_SETMEM_NC interfaces. * sysdeps/i386/tls.h (THREAD_SETMEM): Use size of member element to decide which code to use. (THREAD_SETMEM_NC): Likewise.
This commit is contained in:
@@ -1,5 +1,16 @@
|
|||||||
2002-11-26 Ulrich Drepper <drepper@redhat.com>
|
2002-11-26 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/i386/tls.h (THREAD_GETMEM_NC): Change interface. It now
|
||||||
|
takes the array member name and the index as parameters.
|
||||||
|
(THREAD_SETMEM_NC): Likewise.
|
||||||
|
* pthread_getspecific.c: Use new THREAD_GETMEM_NC interface.
|
||||||
|
* pthread_setspecific.c: Use new THREAD_GETMEM_NC and THREAD_SETMEM_NC
|
||||||
|
interfaces.
|
||||||
|
|
||||||
|
* sysdeps/i386/tls.h (THREAD_SETMEM): Use size of member element
|
||||||
|
to decide which code to use.
|
||||||
|
(THREAD_SETMEM_NC): Likewise.
|
||||||
|
|
||||||
* allocatestack.c (queue_stack): Don't remove stack from list here.
|
* allocatestack.c (queue_stack): Don't remove stack from list here.
|
||||||
Do it in the caller. Correct condition to prematurely terminate
|
Do it in the caller. Correct condition to prematurely terminate
|
||||||
loop to free stacks.
|
loop to free stacks.
|
||||||
|
@@ -45,7 +45,7 @@ __pthread_getspecific (key)
|
|||||||
for this thread since the second level array is not allocated
|
for this thread since the second level array is not allocated
|
||||||
return NULL, too. */
|
return NULL, too. */
|
||||||
struct pthread_key_data *level2 = THREAD_GETMEM_NC (THREAD_SELF,
|
struct pthread_key_data *level2 = THREAD_GETMEM_NC (THREAD_SELF,
|
||||||
specific[idx1st]);
|
specific, idx1st);
|
||||||
if (level2 == NULL)
|
if (level2 == NULL)
|
||||||
/* Not allocated, therefore no data. */
|
/* Not allocated, therefore no data. */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@@ -57,7 +57,7 @@ __pthread_setspecific (key, value)
|
|||||||
idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
|
idx2nd = key % PTHREAD_KEY_2NDLEVEL_SIZE;
|
||||||
|
|
||||||
/* This is the second level array. Allocate it if necessary. */
|
/* This is the second level array. Allocate it if necessary. */
|
||||||
level2 = THREAD_GETMEM_NC (self, specific[idx1st]);
|
level2 = THREAD_GETMEM_NC (self, specific, idx1st);
|
||||||
if (level2 == NULL)
|
if (level2 == NULL)
|
||||||
{
|
{
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
@@ -71,7 +71,7 @@ __pthread_setspecific (key, value)
|
|||||||
if (level2 == NULL)
|
if (level2 == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
THREAD_SETMEM_NC (self, specific[idx1st], level2);
|
THREAD_SETMEM_NC (self, specific, idx1st, level2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pointer to the right array element. */
|
/* Pointer to the right array element. */
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* Definition for thread-local data handling. linuxthreads/i386 version.
|
/* Definition for thread-local data handling. nptl/i386 version.
|
||||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
@@ -253,16 +253,17 @@ union user_desc_init
|
|||||||
|
|
||||||
|
|
||||||
/* Same as THREAD_GETMEM, but the member offset can be non-constant. */
|
/* Same as THREAD_GETMEM, but the member offset can be non-constant. */
|
||||||
# define THREAD_GETMEM_NC(descr, member) \
|
# define THREAD_GETMEM_NC(descr, member, idx) \
|
||||||
({ __typeof (descr->member) __value; \
|
({ __typeof (descr->member[0]) __value; \
|
||||||
if (sizeof (__value) == 1) \
|
if (sizeof (__value) == 1) \
|
||||||
asm ("movb %%gs:(%2),%b0" \
|
asm ("movb %%gs:%P2(%3),%b0" \
|
||||||
: "=q" (__value) \
|
: "=q" (__value) \
|
||||||
: "0" (0), "r" (offsetof (struct pthread, member))); \
|
: "0" (0), "i" (offsetof (struct pthread, member[0])), \
|
||||||
|
"r" (idx)); \
|
||||||
else if (sizeof (__value) == 4) \
|
else if (sizeof (__value) == 4) \
|
||||||
asm ("movl %%gs:(%1),%0" \
|
asm ("movl %%gs:%P1(,%2,4),%0" \
|
||||||
: "=r" (__value) \
|
: "=r" (__value) \
|
||||||
: "r" (offsetof (struct pthread, member))); \
|
: "i" (offsetof (struct pthread, member[0])), "r" (idx)); \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
if (sizeof (__value) != 8) \
|
if (sizeof (__value) != 8) \
|
||||||
@@ -270,32 +271,32 @@ union user_desc_init
|
|||||||
4 or 8. */ \
|
4 or 8. */ \
|
||||||
abort (); \
|
abort (); \
|
||||||
\
|
\
|
||||||
asm ("movl %%gs:(%1),%%eax\n\t" \
|
asm ("movl %%gs:%P1(,%2,8),%%eax\n\t" \
|
||||||
"movl %%gs:4(%1),%%edx" \
|
"movl %%gs:4+%P1(,%2,8),%%edx" \
|
||||||
: "=&A" (__value) \
|
: "=&A" (__value) \
|
||||||
: "r" (offsetof (struct pthread, member))); \
|
: "i" (offsetof (struct pthread, member[0])), "r" (idx)); \
|
||||||
} \
|
} \
|
||||||
__value; })
|
__value; })
|
||||||
|
|
||||||
|
|
||||||
/* Same as THREAD_SETMEM, but the member offset can be non-constant. */
|
/* Same as THREAD_SETMEM, but the member offset can be non-constant. */
|
||||||
# define THREAD_SETMEM(descr, member, value) \
|
# define THREAD_SETMEM(descr, member, value) \
|
||||||
({ if (sizeof (value) == 1) \
|
({ if (sizeof (descr->member) == 1) \
|
||||||
asm volatile ("movb %0,%%gs:%P1" : \
|
asm volatile ("movb %0,%%gs:%P1" : \
|
||||||
: "iq" (value), \
|
: "iq" (value), \
|
||||||
"i" (offsetof (struct pthread, member))); \
|
"i" (offsetof (struct pthread, member))); \
|
||||||
else if (sizeof (value) == 4) \
|
else if (sizeof (descr->member) == 4) \
|
||||||
asm volatile ("movl %0,%%gs:%P1" : \
|
asm volatile ("movl %0,%%gs:%P1" : \
|
||||||
: "ir" (value), \
|
: "ir" (value), \
|
||||||
"i" (offsetof (struct pthread, member))); \
|
"i" (offsetof (struct pthread, member))); \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
if (sizeof (value) != 8) \
|
if (sizeof (descr->member) != 8) \
|
||||||
/* There should not be any value with a size other than 1, \
|
/* There should not be any value with a size other than 1, \
|
||||||
4 or 8. */ \
|
4 or 8. */ \
|
||||||
abort (); \
|
abort (); \
|
||||||
\
|
\
|
||||||
asm volatile ("movl %%eax,%%gs:%P1\n\n" \
|
asm volatile ("movl %%eax,%%gs:%P1\n\t" \
|
||||||
"movl %%edx,%%gs:%P2" : \
|
"movl %%edx,%%gs:%P2" : \
|
||||||
: "A" (value), \
|
: "A" (value), \
|
||||||
"i" (offsetof (struct pthread, member)), \
|
"i" (offsetof (struct pthread, member)), \
|
||||||
@@ -304,26 +305,29 @@ union user_desc_init
|
|||||||
|
|
||||||
|
|
||||||
/* Set member of the thread descriptor directly. */
|
/* Set member of the thread descriptor directly. */
|
||||||
# define THREAD_SETMEM_NC(descr, member, value) \
|
# define THREAD_SETMEM_NC(descr, member, idx, value) \
|
||||||
({ if (sizeof (value) == 1) \
|
({ if (sizeof (descr->member[0]) == 1) \
|
||||||
asm volatile ("movb %0,%%gs:(%1)" : \
|
asm volatile ("movb %0,%%gs:%P1(%2)" : \
|
||||||
: "iq" (value), \
|
: "iq" (value), \
|
||||||
"r" (offsetof (struct pthread, member))); \
|
"i" (offsetof (struct pthread, member)), \
|
||||||
else if (sizeof (value) == 4) \
|
"r" (idx)); \
|
||||||
asm volatile ("movl %0,%%gs:(%1)" : \
|
else if (sizeof (descr->member[0]) == 4) \
|
||||||
|
asm volatile ("movl %0,%%gs:%P1(,%2,4)" : \
|
||||||
: "ir" (value), \
|
: "ir" (value), \
|
||||||
"r" (offsetof (struct pthread, member))); \
|
"i" (offsetof (struct pthread, member)), \
|
||||||
|
"r" (idx)); \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
if (sizeof (value) != 8) \
|
if (sizeof (descr->member[0]) != 8) \
|
||||||
/* There should not be any value with a size other than 1, \
|
/* There should not be any value with a size other than 1, \
|
||||||
4 or 8. */ \
|
4 or 8. */ \
|
||||||
abort (); \
|
abort (); \
|
||||||
\
|
\
|
||||||
asm volatile ("movl %%eax,%%gs:(%1)\n\t" \
|
asm volatile ("movl %%eax,%%gs:%P1(,%2,8)\n\t" \
|
||||||
"movl %%edx,%%gs:4(%1)" : \
|
"movl %%edx,%%gs:4+%P1(,%2,8)" : \
|
||||||
: "A" (value), \
|
: "A" (value), \
|
||||||
"r" (offsetof (struct pthread, member))); \
|
"i" (offsetof (struct pthread, member)), \
|
||||||
|
"r" (idx)); \
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user