summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-03-25 02:33:38 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-03-25 02:33:38 +0100
commit9ca47fe88f480d0137356e82f5ad12f0ca65f399 (patch)
tree49cd894aa49b072ab95a3005122b4d92efad9586
parent189754f96136b0122d286d90de97026e9505fd74 (diff)
parent5eb8bf00737bafdeb78b0df2688876f538d74857 (diff)
Merge branch 't/tls' into refs/top-bases/tschwinge/Roger_Whittaker
-rw-r--r--mach/setup-thread.c2
-rw-r--r--sysdeps/mach/hurd/bits/libc-lock.h6
-rw-r--r--sysdeps/mach/hurd/i386/init-first.c8
-rw-r--r--sysdeps/mach/hurd/i386/tls.h10
-rw-r--r--sysdeps/mach/thread_state.h2
5 files changed, 14 insertions, 14 deletions
diff --git a/mach/setup-thread.c b/mach/setup-thread.c
index f4e3a28a41..2fab79c391 100644
--- a/mach/setup-thread.c
+++ b/mach/setup-thread.c
@@ -94,7 +94,7 @@ __mach_setup_tls (thread_t thread)
assert (tssize == MACHINE_THREAD_STATE_COUNT);
tcb = _dl_allocate_tls (NULL);
- if (!tcb)
+ if (tcb == NULL)
return KERN_RESOURCE_SHORTAGE;
_hurd_tls_new (thread, &ts, tcb);
diff --git a/sysdeps/mach/hurd/bits/libc-lock.h b/sysdeps/mach/hurd/bits/libc-lock.h
index a0f83728e4..0a7fb0bf8c 100644
--- a/sysdeps/mach/hurd/bits/libc-lock.h
+++ b/sysdeps/mach/hurd/bits/libc-lock.h
@@ -20,9 +20,9 @@
#define _BITS_LIBC_LOCK_H 1
#if (_LIBC - 0) || (_CTHREADS_ - 0)
-#if (_LIBC - 0)
-#include <tls.h>
-#endif
+# if (_LIBC - 0)
+# include <tls.h>
+# endif
#include <cthreads.h>
typedef struct mutex __libc_lock_t;
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index 1a587dcc8d..064561a63d 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -112,9 +112,7 @@ init1 (int argc, char *arg0, ...)
then after the environment pointers there is no Hurd
data block; the argument strings start there. */
if ((void *) d == argv[0])
- {
- return;
- }
+ return;
#ifndef SHARED
__libc_enable_secure = d->flags & EXEC_SECURE;
@@ -192,8 +190,8 @@ init (int *data)
assert (d->phdrsz % sizeof (ElfW(Phdr)) == 0);
}
- /* We need to setup TLS before starting sigthread */
- extern void __pthread_initialize_minimal(void);
+ /* We need to setup TLS before starting the signal thread. */
+ extern void __pthread_initialize_minimal (void);
__pthread_initialize_minimal ();
#endif
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h
index 1b6fe67af2..3fc3e2cfaa 100644
--- a/sysdeps/mach/hurd/i386/tls.h
+++ b/sysdeps/mach/hurd/i386/tls.h
@@ -37,6 +37,8 @@
# define __i386_set_gdt(thr, sel, desc) ((void) (thr), (void) (sel), (void) (desc), MIG_BAD_ID)
# endif
+#define __i386_selector_is_ldt(sel) (!!((sel) & 4))
+
# include <errno.h>
# include <assert.h>
@@ -108,7 +110,7 @@ _hurd_tls_init (tcbhead_t *tcb, int secondcall)
/* Fetch the selector set by the first call. */
int sel;
asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0));
- if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
+ if (__glibc_unlikely (__i386_selector_is_ldt(sel)))
{
kern_return_t err = __i386_set_ldt (self, sel, &desc, 1);
assert_perror (err);
@@ -189,7 +191,7 @@ _hurd_tls_fork (thread_t child, thread_t orig, struct i386_thread_state *state)
kern_return_t err;
unsigned int count = 1;
- if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
+ if (__glibc_unlikely (__i386_selector_is_ldt(sel)))
err = __i386_get_ldt (orig, sel, 1, &_desc, &count);
else
err = __i386_get_gdt (orig, sel, &desc);
@@ -198,7 +200,7 @@ _hurd_tls_fork (thread_t child, thread_t orig, struct i386_thread_state *state)
if (err)
return err;
- if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
+ if (__glibc_unlikely (__i386_selector_is_ldt(sel)))
err = __i386_set_ldt (child, sel, &desc, 1);
else
err = __i386_set_gdt (child, &sel, desc);
@@ -222,7 +224,7 @@ _hurd_tls_new (thread_t child, struct i386_thread_state *state, tcbhead_t *tcb)
tcb->tcb = tcb;
tcb->self = child;
- if (__builtin_expect (sel, 0x48) & 4) /* LDT selector */
+ if (__glibc_unlikely (__i386_selector_is_ldt(sel)))
err = __i386_set_ldt (child, sel, &desc, 1);
else
err = __i386_set_gdt (child, &sel, desc);
diff --git a/sysdeps/mach/thread_state.h b/sysdeps/mach/thread_state.h
index 357c8bfbea..a6d3634070 100644
--- a/sysdeps/mach/thread_state.h
+++ b/sysdeps/mach/thread_state.h
@@ -38,7 +38,7 @@
#endif
#endif
#ifndef MACHINE_THREAD_STATE_FIX_NEW
-#define MACHINE_THREAD_STATE_FIX_NEW(ts)
+# define MACHINE_THREAD_STATE_FIX_NEW(ts)
#endif
/* These functions are of use in machine-dependent signal trampoline