From 054467701684bff163c8ee72da4827d73c407c8b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 2 Sep 2004 23:58:23 +0000 Subject: 2004-09-02 Roland McGrath * 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. --- sysdeps/mach/hurd/i386/tls.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'sysdeps/mach/hurd') 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 */ -- cgit 1.4.1