Drop using _tlsbase and _tlstop in favor of access via NtCurrentTeb.

* cygtls.h (_tlsbase): Remove.  Replace throughout with
        NtCurrentTeb()->Tib.StackBase.
        (_tlstop): Remove. Replace throughout with
        NtCurrentTeb()->Tib.StackLimit.
        * dcrt0.cc (child_info_fork::alloc_stack): Move definition of local
        teb variable up to be used throughout.
        * include/cygwin/config.h (__getreent): Use inline function on both
        architectures.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2015-12-02 12:11:06 +01:00
parent 8e6213210d
commit 7b0c063f12
7 changed files with 43 additions and 42 deletions

View File

@ -40,20 +40,19 @@ extern "C" {
#ifdef _COMPILING_NEWLIB
#ifdef __x86_64__
#include "../tlsoffsets64.h"
/* We would like to use just "%gs:8", but on x86_64 gcc uses pc-relative
addressing and translates "gs:8" into the wrong addressing mode. */
static inline char *___getreent (void)
{
register char *ret;
__asm __volatile__ ("movq %%gs:8,%0" : "=r" (ret));
return ret + tls_local_clib;
}
#define __getreent() ((struct _reent *) ___getreent())
#else
#include "../tlsoffsets.h"
extern char *_tlsbase __asm__ ("%fs:4");
#define __getreent() (struct _reent *)(_tlsbase + tls_local_clib)
#endif
extern inline struct _reent *__getreent (void)
{
register char *ret;
#ifdef __x86_64__
__asm __volatile__ ("movq %%gs:8,%0" : "=r" (ret));
#else
__asm __volatile__ ("movl %%fs:4,%0" : "=r" (ret));
#endif
return (struct _reent *) (ret + tls_local_clib);
}
#endif /* _COMPILING_NEWLIB */
#ifdef __x86_64__