about summary refs log tree commit diff
path: root/linuxthreads/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-08-28 14:02:28 +0000
committerUlrich Drepper <drepper@redhat.com>1998-08-28 14:02:28 +0000
commit75311719d35dc0c132e46f883beaeb5b3d9eb75a (patch)
tree364ae797e245ca6942072912a682eaab6756fdd3 /linuxthreads/sysdeps
parent997a416551a7d5ceb91978674cb8c70b443329d0 (diff)
downloadglibc-75311719d35dc0c132e46f883beaeb5b3d9eb75a.tar.gz
glibc-75311719d35dc0c132e46f883beaeb5b3d9eb75a.tar.xz
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')
-rw-r--r--linuxthreads/sysdeps/i386/useldt.h50
-rw-r--r--linuxthreads/sysdeps/sparc/sparc32/pt-machine.h2
-rw-r--r--linuxthreads/sysdeps/sparc/sparc64/pt-machine.h2
3 files changed, 52 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)));			      \
+    }									      \
+})
diff --git a/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h b/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h
index 7eea8d400c..894972d574 100644
--- a/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h
+++ b/linuxthreads/sysdeps/sparc/sparc32/pt-machine.h
@@ -56,4 +56,6 @@ register struct _pthread_descr_struct *__thread_self __asm__("%g6");
 
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) __thread_self->member
+#define THREAD_GETMEM_NC(descr, member) __thread_self->member
 #define THREAD_SETMEM(descr, member, value) __thread_self->member = (value)
+#define THREAD_SETMEM_NC(descr, member, value) __thread_self->member = (value)
diff --git a/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h b/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h
index e94e1a5fb2..24c214117c 100644
--- a/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h
+++ b/linuxthreads/sysdeps/sparc/sparc64/pt-machine.h
@@ -68,4 +68,6 @@ __compare_and_swap (long int *p, long int oldval, long int newval)
 
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) __thread_self->member
+#define THREAD_GETMEM_NC(descr, member) __thread_self->member
 #define THREAD_SETMEM(descr, member, value) __thread_self->member = (value)
+#define THREAD_SETMEM_NC(descr, member, value) __thread_self->member = (value)