summary refs log tree commit diff
path: root/linuxthreads/sysdeps/i386/tls.h
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/sysdeps/i386/tls.h')
-rw-r--r--linuxthreads/sysdeps/i386/tls.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/linuxthreads/sysdeps/i386/tls.h b/linuxthreads/sysdeps/i386/tls.h
index 03d36de486..3e7e4c3302 100644
--- a/linuxthreads/sysdeps/i386/tls.h
+++ b/linuxthreads/sysdeps/i386/tls.h
@@ -122,8 +122,8 @@ typedef struct
 /* Code to initially initialize the thread pointer.  This might need
    special attention since 'errno' is not yet available and if the
    operation can cause a failure 'errno' must not be touched.  */
-#  define TLS_INIT_TP(descr) \
-  do {									      \
+#  define TLS_INIT_TP(descr)						      \
+  ({									      \
     void *_descr = (descr);						      \
     tcbhead_t *head = _descr;						      \
     int __gs;								      \
@@ -133,11 +133,13 @@ typedef struct
     head->self = _descr;						      \
 									      \
     __gs = TLS_SETUP_GS_SEGMENT (_descr);				      \
-    if (__builtin_expect (__gs, 7) == -1)				      \
-      /* Nothing else we can do.  */					      \
-      asm ("hlt");							      \
-    asm ("movw %w0, %%gs" : : "q" (__gs));				      \
-  } while (0)
+    if (__builtin_expect (__gs, 7) != -1)				      \
+      {									      \
+	asm ("movw %w0, %%gs" : : "q" (__gs));				      \
+	__gs = 0;							      \
+      }									      \
+    __gs;								      \
+  })
 
 
 /* Return the address of the dtv for the current thread.  */