diff options
author | Andreas Schwab <schwab@suse.de> | 2014-05-13 16:40:41 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2014-05-27 14:48:46 +0200 |
commit | 774f928582fcfefb726f115772c001043aefa01c (patch) | |
tree | 25a1d36a397a74b00e2438caf52dfa5dfa0d3124 /sysdeps/mach/hurd/i386 | |
parent | 36ffe7398af5e5daa5745c64a15226d864378738 (diff) | |
download | glibc-774f928582fcfefb726f115772c001043aefa01c.tar.gz glibc-774f928582fcfefb726f115772c001043aefa01c.tar.xz glibc-774f928582fcfefb726f115772c001043aefa01c.zip |
Remove second argument from TLS_INIT_TP macro
Diffstat (limited to 'sysdeps/mach/hurd/i386')
-rw-r--r-- | sysdeps/mach/hurd/i386/tls.h | 75 |
1 files changed, 26 insertions, 49 deletions
diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index 03741cd9fe..5b7abd0767 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -90,69 +90,46 @@ typedef struct static inline const char * __attribute__ ((unused)) -_hurd_tls_init (tcbhead_t *tcb, int secondcall) +_hurd_tls_init (tcbhead_t *tcb) { HURD_TLS_DESC_DECL (desc, tcb); - if (!secondcall) + /* This field is used by TLS accesses to get our "thread pointer" + from the TLS point of view. */ + tcb->tcb = tcb; + + /* Cache our thread port. */ + tcb->self = __mach_thread_self (); + + /* Get the first available selector. */ + int sel = -1; + error_t err = __i386_set_gdt (tcb->self, &sel, desc); + if (err == MIG_BAD_ID) { - /* This field is used by TLS accesses to get our "thread pointer" - from the TLS point of view. */ - tcb->tcb = tcb; - - /* Cache our thread port. */ - tcb->self = __mach_thread_self (); - - /* Get the first available selector. */ - int sel = -1; - error_t err = __i386_set_gdt (tcb->self, &sel, desc); - if (err == MIG_BAD_ID) - { - /* Old kernel, use a per-thread LDT. */ - sel = 0x27; - err = __i386_set_ldt (tcb->self, sel, &desc, 1); - assert_perror (err); - if (err) - return "i386_set_ldt failed"; - } - else if (err) - { - assert_perror (err); /* Separate from above with different line #. */ - return "i386_set_gdt failed"; - } - - /* Now install the new selector. */ - asm volatile ("mov %w0, %%gs" :: "q" (sel)); + /* Old kernel, use a per-thread LDT. */ + sel = 0x27; + err = __i386_set_ldt (tcb->self, sel, &desc, 1); + assert_perror (err); + if (err) + return "i386_set_ldt failed"; } - else + else if (err) { - /* Fetch the selector set by the first call. */ - int sel; - asm ("mov %%gs, %w0" : "=q" (sel) : "0" (0)); - if (__builtin_expect (sel, 0x50) & 4) /* LDT selector */ - { - error_t err = __i386_set_ldt (tcb->self, sel, &desc, 1); - assert_perror (err); - if (err) - return "i386_set_ldt failed"; - } - else - { - error_t err = __i386_set_gdt (tcb->self, &sel, desc); - assert_perror (err); - if (err) - return "i386_set_gdt failed"; - } + assert_perror (err); /* Separate from above with different line #. */ + return "i386_set_gdt failed"; } + /* Now install the new selector. */ + asm volatile ("mov %w0, %%gs" :: "q" (sel)); + return 0; } /* 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, secondcall) \ - _hurd_tls_init ((tcbhead_t *) (descr), (secondcall)) +# define TLS_INIT_TP(descr) \ + _hurd_tls_init ((tcbhead_t *) (descr)) /* Return the TCB address of the current thread. */ # define THREAD_SELF \ |