about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2004-09-02 23:58:23 +0000
committerRoland McGrath <roland@gnu.org>2004-09-02 23:58:23 +0000
commit054467701684bff163c8ee72da4827d73c407c8b (patch)
tree26e0c052a4ad2e7a62e3b3d5041c461121d04b23
parentf76c8499101d2826013989954dcbccf5fb8321be (diff)
downloadglibc-054467701684bff163c8ee72da4827d73c407c8b.tar.gz
glibc-054467701684bff163c8ee72da4827d73c407c8b.tar.xz
glibc-054467701684bff163c8ee72da4827d73c407c8b.zip
2004-09-02 Roland McGrath <roland@redhat.com>
	* sysdeps/mach/hurd/i386/tls.h (TLS_INIT_TP_EXPENSIVE): New macro.
	(INSTALL_NEW_DTV, THREAD_DTV): Rewritten to fetch the right word.
	(THREAD_SELF): New macro.
-rw-r--r--sysdeps/mach/hurd/i386/tls.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index 4b21349545..2863ac8691 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -1,5 +1,5 @@
 /* Definitions for thread-local data handling.  Hurd/i386 version.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -113,14 +113,25 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
    operation can cause a failure 'errno' must not be touched.  */
 # define TLS_INIT_TP(descr, secondcall) \
     _hurd_tls_init ((tcbhead_t *) (descr), (secondcall))
+# define TLS_INIT_TP_EXPENSIVE 1
+
+/* Return the TCB address of the current thread.  */
+# define THREAD_SELF \
+  ({ tcbhead_t *__tcb;
+     __asm__ ("movl %%gs:%c1,%0" : "=r" (__tcb)		\
+	      : "i" (offsetof (tcbhead_t, tcb))); 	\
+     __tcb;})
 
 /* Install new dtv for current thread.  */
-# define INSTALL_NEW_DTV(dtv) \
-  ({ __asm__ ("movl %0, %%gs:0" : : "r" (dtv)); })
+# define INSTALL_NEW_DTV(dtvp) \
+  ({ asm volatile ("movl %0,%%gs:%P1"
+		   : : "ir" (dtvp), "i" (offsetof (tcbhead_t, dtv))); })
 
 /* Return the address of the dtv for the current thread.  */
 # define THREAD_DTV() \
-  ({ void *_dtv; __asm__ ("movl %%gs:0, %0" : "=r" (_dtv)); _dtv; })
+  ({ void *_dtv;
+     asm ("movl %%gs:%P1,%0" : "=q" (_dtv) : "i" (offsetof (tcbhead_t, dtv)));
+     _dtv; })
 
 # endif	/* !ASSEMBLER */
 #endif /* HAVE_TLS_SUPPORT */