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

@@ -286,18 +286,7 @@ private:
#include "cygerrno.h"
#include "ntdll.h"
#ifdef __x86_64__
/* When just using a "gs:X" asm for the x86_64 code, gcc wrongly creates
pc-relative instructions. However, NtCurrentTeb() is inline assembler
anyway, so using it here should be fast enough on x86_64. */
#define _tlsbase (NtCurrentTeb()->Tib.StackBase)
#define _tlstop (NtCurrentTeb()->Tib.StackLimit)
#else
extern PVOID _tlsbase __asm__ ("%fs:4");
extern PVOID _tlstop __asm__ ("%fs:8");
#endif
#define _my_tls (*((_cygtls *) ((char *)_tlsbase - CYGTLS_PADSIZE)))
#define _my_tls (*((_cygtls *) ((PBYTE) NtCurrentTeb()->Tib.StackBase - CYGTLS_PADSIZE)))
extern _cygtls *_main_tls;
extern _cygtls *_sig_tls;