diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-08-28 14:02:28 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-08-28 14:02:28 +0000 |
commit | 75311719d35dc0c132e46f883beaeb5b3d9eb75a (patch) | |
tree | 364ae797e245ca6942072912a682eaab6756fdd3 /linuxthreads/sysdeps/i386/useldt.h | |
parent | 997a416551a7d5ceb91978674cb8c70b443329d0 (diff) | |
download | glibc-75311719d35dc0c132e46f883beaeb5b3d9eb75a.tar glibc-75311719d35dc0c132e46f883beaeb5b3d9eb75a.tar.gz glibc-75311719d35dc0c132e46f883beaeb5b3d9eb75a.tar.bz2 glibc-75311719d35dc0c132e46f883beaeb5b3d9eb75a.zip |
Update.
1998-08-28 13:58 Ulrich Drepper <drepper@cygnus.com>
* internals.h: Also define THREAD_GETMEM_NC and THREAD_SETMEM_NC to
access thread data with non-constant offsets.
* specific.c: Use THREAD_GETMEM_NC and THREAD_SETMEM_NC where
necessary.
* sysdeps/i386/useldt.h: Fix typo. Add THREAD_GETMEM_NC and
THREAD_SETMEM_NC definitions.
* sysdeps/sparc/sparc32/pt-machine.h: Define THREAD_GETMEM_NC and
THREAD_SETMEM_NC.
* sysdeps/sparc/sparc64/pt-machine.h: Likewise.
Diffstat (limited to 'linuxthreads/sysdeps/i386/useldt.h')
-rw-r--r-- | linuxthreads/sysdeps/i386/useldt.h | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/linuxthreads/sysdeps/i386/useldt.h b/linuxthreads/sysdeps/i386/useldt.h index 53cf522951..1a789e2e0a 100644 --- a/linuxthreads/sysdeps/i386/useldt.h +++ b/linuxthreads/sysdeps/i386/useldt.h @@ -82,7 +82,7 @@ extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); ({ \ __typeof__ (descr->member) __value; \ if (sizeof (__value) == 1) \ - __asm__ __volatile__ ("movb %%gs:%P1,%b0" \ + __asm__ __volatile__ ("movb %%gs:%P2,%b0" \ : "=r" (__value) \ : "0" (0), \ "i" (offsetof (struct _pthread_descr_struct, \ @@ -101,7 +101,31 @@ extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); __value; \ }) -/* Set member of the thread descriptor directly. */ +/* Same as THREAD_GETMEM, but the member offset can be non-constant. */ +#define THREAD_GETMEM_NC(descr, member) \ +({ \ + __typeof__ (descr->member) __value; \ + if (sizeof (__value) == 1) \ + __asm__ __volatile__ ("movb %%gs:(%2),%b0" \ + : "=r" (__value) \ + : "0" (0), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else \ + { \ + if (sizeof (__value) != 4) \ + /* There should not be any value with a size other than 1 or 4. */ \ + abort (); \ + \ + __asm__ __volatile__ ("movl %%gs:(%1),%0" \ + : "=r" (__value) \ + : "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + } \ + __value; \ +}) + +/* Same as THREAD_SETMEM, but the member offset can be non-constant. */ #define THREAD_SETMEM(descr, member, value) \ ({ \ __typeof__ (descr->member) __value = (value); \ @@ -122,3 +146,25 @@ extern int __modify_ldt (int, struct modify_ldt_ldt_s *, size_t); member))); \ } \ }) + +/* Set member of the thread descriptor directly. */ +#define THREAD_SETMEM_NC(descr, member, value) \ +({ \ + __typeof__ (descr->member) __value = (value); \ + if (sizeof (__value) == 1) \ + __asm__ __volatile__ ("movb %0,%%gs:(%1)" : \ + : "r" (__value), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + else \ + { \ + if (sizeof (__value) != 4) \ + /* There should not be any value with a size other than 1 or 4. */ \ + abort (); \ + \ + __asm__ __volatile__ ("movl %0,%%gs:(%1)" : \ + : "r" (__value), \ + "r" (offsetof (struct _pthread_descr_struct, \ + member))); \ + } \ +}) |